0
/login要求の認証をスキップします。 春の起動時に/ loginの認証をスキップする
@Configuration
@EnableResourceServer
protected class ResourceServer extends ResourceServerConfigurerAdapter {
@Override
public void configure(HttpSecurity http) throws Exception {
http.authorizeRequests().antMatchers("/login").permitAll();
}
}
しかし、
/ログインエンドポイントをヒットしようとしたときに、私がどんな引数/ヘッダ、(今、この応答を取得していないよ:私のサーバアプリケーションで
、私はそれを達成するために、この方法を書きました私が)合格:
{
"timestamp": 1493881871867,
"status": 415,
"error": "Unsupported Media Type",
"exception": "org.springframework.web.HttpMediaTypeNotSupportedException",
"message": "Content type 'application/x-www-form-urlencoded;charset=UTF-8' not supported",
"path": "/login"
}
はconsumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE,
、いくつかの他の同様のソリューションをしようとしましたが、それでも同じ応答を得ます。
も/ログインのためのエンドポイントを作成し、それはヒットを取得していない:
@RequestMapping(value = "/login",
method = RequestMethod.POST,
produces = "application/json")
public ResponseEntity login(@RequestBody Map<String, String> requestBody) {
System.out.println("DO I EVEN REACH HERE?");
return null;
}
私は春に非常に新しいですし、私はここでやっているのミスを把握することはできません。どんな助け?
'.antMatchers("/login * ")。anonymous()'? btw JSONを本当に送信しますか?コンテンツタイプが間違っている可能性があります。 – StanislavL
did not worked .. :( –
あなたの呼び出しに '.anyRequest();'を追加してみてください。 – Kai