2016-05-18 6 views
0

私は、春のチュートリアル「OAuth2:SSA with Angular JS and Spring Security Part V」に従った。スプリングブートOauthカスタムログインフォーム

カスタムログインフォームがもう動作しなくなった後、「authserver」プロジェクトをmavenからgradleに変換しました。

ログインフォームに必要なpom.xmlのwroタスクは機能していますか?

どちらか私はまた、このチュートリアルを試してみましたが、それは私のシナリオでは動作しませんでした: http://docs.spring.io/spring-security/site/docs/3.2.x/guides/form.html

私はあなたが私を助けることができることを願っています。

ログファイル:

2016年5月18日11:14:53.667 DEBUG 22312 --- [NIO-9999-EXEC-9] ossecurity.web.FilterChainProxy:14の5位に/ログイン追加のフィルターチェーンで。 [Nio-9999-exec-9] osswumatcher.AntPathRequestMatcher:リクエスト 'GET/login'が 'POST/logout'と一致しません 2016-05-18 11:14:53.667 DEBUG 22312 --- [nio-9999-exec-9] ossecurity.web.FilterChainProxy:/追加のフィルタチェーンの14の位置6にログインします。フィルタリング: 'UsernamePasswordAuthenticationFilter' 2016-05-18 11:14:53.667 DEBUG 22312 --- [nio-9999-exec-9] osswumatcher.AntPathRequestMatcher:リクエスト 'GET/login'が 'POST/login'と一致しません 2016-05-18 11:14:53.667 DEBUG 22312 --- [nio-9999-exec-9] ossecurity.web.FilterChainProxy:/追加のフィルタチェーン内の14の位置7にログインします。ファイアウォールフィルタ: 'DefaultLoginPageGeneratingFilter' 2016-05-18 11:14:53.667 DEBUG 22312 --- [nio-9999-exec-9] wcHttpSessionSecurityContextRepository:SecurityContextが空であるか内容が匿名です - コンテキストが格納されませんHttpSession。

コードOAuth2ServerConfigurationで:

@Override 
    public void configure(HttpSecurity http) throws Exception { 
     http.formLogin().loginPage("/login").permitAll() 
      .and().requestMatchers() 
       .antMatchers("/login", "/oauth/authorize", "/oauth/confirm_access") 
      .and().authorizeRequests() 
       .anyRequest().authenticated(); 
    } 

MainAuthserverApplication.java@ComponentScan @SessionAttributes("authorizationRequest") @EnableAutoConfiguration() @EnableConfigurationProperties({AuthProperties.class}) public class MainAuthserverApplication extends WebMvcConfigurerAdapter {

@Override 
public void addViewControllers(ViewControllerRegistry registry) { 
    registry.addViewController("/login").setViewName("login"); 
    registry.setOrder(Ordered.HIGHEST_PRECEDENCE); 
    registry.addViewController("/oauth/confirm_access").setViewName("authorize"); 
} 

答えて

0

I既に固定番目電子の問題私自身は:

@Configuration 
@Order(-20) 
protected static class LoginConfig extends WebSecurityConfigurerAdapter { 

    @Autowired 
    private AuthenticationManager authenticationManager; 

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


     // @formatter:off 
     http.formLogin().loginPage("/login").permitAll().and().requestMatchers() 
      .antMatchers("/login", "/oauth/authorize", "/oauth/confirm_access").and().authorizeRequests() 
      .anyRequest().authenticated(); 
     // @formatter:on 
    } 

    @Override 
    protected void configure(AuthenticationManagerBuilder auth) throws Exception { 
     auth.parentAuthenticationManager(authenticationManager); 
    } 
} 

これら2つの方法が同じクラスでなければならないようです

関連する問題