2016-10-26 15 views
0

私はSpring Securityでいくつかの従来のAngularアプリケーションを保護しようとしています。 全体の角度静的なものがSpring Security - AngularJS - 角型静的コンテンツの保護

src/main/resources/static 

下にあり、確保の対象とすべきすべてのものは、ここで

src/main/resources/static/protected-stuff 

下にある私の設定は(それが全体的な春ブーツアプリの構成の一部である)である。

@Override 
    protected void configure(HttpSecurity http) throws Exception { 
     http.formLogin() 
       .loginPage("/login.html").permitAll() 
       .loginProcessingUrl("/dologin") 
       .failureForwardUrl("/login.html?isError=true") 
       .failureUrl("/login.html?isError=true") 
       .defaultSuccessUrl("/protected-stuff/index.html") 
       .and() 
       .authorizeRequests() 
       .antMatchers(HttpMethod.GET, "/", "/index.html", "/home.html", "/login/**").permitAll() 
       .antMatchers("/protected-stuff/**").authenticated() 
       .and() 
       .csrf().disable(); 
    } 

今、私には問題がある部分がある:

    .antMatchers("/protected-stuff/**").authenticated() 

errorneusログイン時にリダイレクトすると、認証リクエストが処理されます(AuthenticationProviderに遭遇します)などが動作しますが、認証が成功した後は保護されたものにリダイレクトされ、ログインページにリダイレクトされます。今私はリソースフィルタとSpring Secインターセプタ(ok、再び、フィルタ)が互いに衝突していると思われますが、このような状況を克服することは本当に確実ではありませんか?

ご協力いただきありがとうございます。

答えて

0

私は、Spring SecurityとSpring Bootを使ってデバッグすることで、実際の問題点を特定することができました。実際には、Springブートがロードするコンフィギュレーションの順序です。 Spring Security自体には何もありません。だから、基本的には、Spring Secのconfigの最高位を与えることでした。

関連する問題