提交 483f7a33 编写于 作者: L lbw

🎨 Improving structure / format of the code.

上级 9c3bc313
...@@ -30,7 +30,7 @@ import org.springframework.security.web.authentication.SavedRequestAwareAuthenti ...@@ -30,7 +30,7 @@ import org.springframework.security.web.authentication.SavedRequestAwareAuthenti
* @date 2019/2/1 * @date 2019/2/1
*/ */
@EnableWebSecurity @EnableWebSecurity
public class WebSecurityConfigurer{ public class WebSecurityConfigurer {
private final String adminContextPath; private final String adminContextPath;
...@@ -49,23 +49,12 @@ public class WebSecurityConfigurer{ ...@@ -49,23 +49,12 @@ public class WebSecurityConfigurer{
SavedRequestAwareAuthenticationSuccessHandler successHandler = new SavedRequestAwareAuthenticationSuccessHandler(); SavedRequestAwareAuthenticationSuccessHandler successHandler = new SavedRequestAwareAuthenticationSuccessHandler();
successHandler.setTargetUrlParameter("redirectTo"); successHandler.setTargetUrlParameter("redirectTo");
successHandler.setDefaultTargetUrl(adminContextPath + "/"); successHandler.setDefaultTargetUrl(adminContextPath + "/");
http http.headers().frameOptions().disable().and().authorizeRequests()
.headers().frameOptions().disable() .antMatchers(adminContextPath + "/assets/**", adminContextPath + "/login",
.and().authorizeRequests() adminContextPath + "/instances/**", adminContextPath + "/actuator/**")
.antMatchers(adminContextPath + "/assets/**" .permitAll().anyRequest().authenticated().and().formLogin().loginPage(adminContextPath + "/login")
, adminContextPath + "/login" .successHandler(successHandler).and().logout().logoutUrl(adminContextPath + "/logout").and().httpBasic()
, adminContextPath + "/instances/**" .and().csrf().disable();
, adminContextPath + "/actuator/**"
).permitAll()
.anyRequest().authenticated()
.and()
.formLogin().loginPage(adminContextPath + "/login")
.successHandler(successHandler).and()
.logout().logoutUrl(adminContextPath + "/logout")
.and()
.httpBasic().and()
.csrf()
.disable();
return http.build(); return http.build();
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册