oauth2(リソースサーバーとして)で正しく動作するスプリングブートアプリケーションがあります。カスタムconfigure(HttpSecurity http)
メソッドはありません。のみoauth2でスプリングセキュリティのカスタム設定を追加できません
spring-boot-starter-security
spring-security-oauth2
spring-security-jwt
がpomに追加されます。
ここで、保護されていないエンドポイントを追加します。だから、(回答SO多くは以下の)私は追加で開始:
@Configuration
public class Security extends ResourceServerConfigurerAdapter {
@Override
public void configure(HttpSecurity http) throws Exception {
}
}
、その後、私が得た:
Cannot apply org.springframework.security.config.[email protected]6513fd22 to already built object
全エラー:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'springSecurityFilterChain' defined in class path resource [org/springframework/security/config/annotation/web/configuration/WebSecurityConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.servlet.Filter]: Factory method 'springSecurityFilterChain' threw exception; nested exception is java.lang.IllegalStateException: Cannot apply org.springframework.security.config.[email protected]6513fd22 to already built object
それでは、どのように私は追加するには、私のセキュリティを設定する必要があります匿名アクセスのエンドポイント?