2017-06-13 44 views
0

私はWebアプリケーションの認証を取り込もうとしています。 ユーザーはログインページを介して正常に終了しましたが、他のページにはまだアクセスできません。春のセキュリティ - 成功した認証の後のアクセスなし

最初は問題はActive Directoryと関係があると思いましたが、デバッグのためのメモリ認証に切り替わった後、どちらも正しく動作しないことがわかりました。

これは私のセキュリティの設定です:ログイン後

@EnableWebSecurity 
@Configuration 
public class WebSecurityConfig extends WebSecurityConfigurerAdapter { 

    @Override 
    protected void configure(HttpSecurity http) throws Exception { 

    http 
     .csrf() 
      .disable() 
     .authorizeRequests() 
      .antMatchers("/css/**").permitAll() 
      .antMatchers("/js/**").permitAll() 
      .antMatchers("/img/**").permitAll() 
      .anyRequest().authenticated() 
      .and() 
     .formLogin() 
      .and() 
     .logout() 
      .permitAll(); 
    } 

    @Override 
    public void configure(AuthenticationManagerBuilder auth) throws Exception { 
     auth.inMemoryAuthentication().withUser("user").password("test").roles("USER"); 
    } 

} 

、私はログに成功した認証を取得:

Authentication event AuthenticationSuccessEvent: user; details: org.sprin[email protected]b364: RemoteIpAddress: 0:0:0:0:0:0:0:1; SessionId: null 
Authentication event InteractiveAuthenticationSuccessEvent: user; details: org.sprin[email protected]b364: RemoteIpAddress: 0:0:0:0:0:0:0:1; SessionId: null 

私は代わりの要求に、ログインページに戻ってリダイレクトされますがリソース。手動でリソースに移動しても、ログインページにリダイレクトされます。

私の間違いは明白ですか、何か不足していますか?

答えて

0

解決策が見つかりました。

明らかに、セキュリティコンテキストセッションを何らかの形で妨害していたアプリケーション設定には、いくつかの設定オプションがありました。

これらを削除すると、認証が正常に実行されます。