2016-10-21 2 views
2

스프링 보안이 나를 리디렉션한다는 문제가 있습니다. 따라서 브라우저는 측면을 구축 할 수 없습니다. 내 코드에 무슨 문제가 있습니까?스프링 보안 HTTPS

@Override 
protected void configure(HttpSecurity http) throws Exception { 
    http 
      .authorizeRequests() 
       .antMatchers("/resources/**").permitAll() 
       .and() 
      .authorizeRequests() 
       .anyRequest() 
       .fullyAuthenticated() 
       .and() 
      .authorizeRequests() 
       .antMatchers("/login").permitAll() 
       .and() 
      .formLogin() 
       .and() 
      .httpBasic() 
       .and() 
      .requiresChannel() 
       .anyRequest() 
        .requiresSecure() 
       .and() 
      .csrf().disable(); 
} 

나는 사용자가 "로컬 호스트 : 8585/로그인"에 액세스 할 수있을 것이라고 생각했다. 때문에 ("/ 로그인")는 .antMatchers의, permitAll()?

+0

어디 로그인이 어디에 있습니까? –

+0

주문이 여기에 영향을 줄 수 있습니다. antMatchers ("/ login")로 전체 블록을 "authenticated" – freakman

답변

2

주문 사항 여기

@Override 
protected void configure(HttpSecurity http) throws Exception { 
    http 
      .authorizeRequests() 
       .antMatchers("/resources/**").permitAll() 
       .antMatchers("/login*").anonymous() 
       .anyRequest().authenticated() 
       .and()    
      .formLogin().loginPage("/login") 
       .and() 
      .logout().logoutSuccessUrl("/login.html") 
       .and() 
      .httpBasic() 
       .and() 
      .requiresChannel() 
       .anyRequest() 
        .requiresSecure() 
       .and() 
      .csrf().disable(); 
}