wei.zhang2 2017-10-16 14:30:43 +08:00
parent 5082df5be4
commit 470b210f65
2 changed files with 16 additions and 2 deletions

View File

@ -0,0 +1,14 @@
package com.boot.security.server.config;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.view.RedirectView;
@Controller
public class LoginPageConfig {
@RequestMapping("/")
public RedirectView loginPage() {
return new RedirectView("/login.html");
}
}

View File

@ -55,8 +55,8 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
http.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS);
http.authorizeRequests()
.antMatchers(HttpMethod.GET, "/*.html", "/favicon.ico", "/css/**", "/js/**", "/fonts/**", "/layui/**",
"/img/**", "/v2/api-docs/**", "/swagger-resources/**", "/webjars/**", "/pages/**")
.antMatchers(HttpMethod.GET, "/", "/*.html", "/favicon.ico", "/css/**", "/js/**", "/fonts/**",
"/layui/**", "/img/**", "/v2/api-docs/**", "/swagger-resources/**", "/webjars/**", "/pages/**")
.permitAll().anyRequest().authenticated();
http.formLogin().loginPage("/login.html").loginProcessingUrl("/login")
.successHandler(authenticationSuccessHandler).failureHandler(authenticationFailureHandler).and()