Commit d6bfa9c1 by chenzx

单点登录跳转配置首页地址

parent bcb3b51f
......@@ -22,6 +22,8 @@ public class RESTAuthenticationSuccessHandler extends SimpleUrlAuthenticationSuc
@Value("${security.allowRootLogin:true}")
private boolean rootAllowLogin = true;
@Value("${sso.go}")
private String go;
@Override
public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response,
......@@ -37,7 +39,7 @@ public class RESTAuthenticationSuccessHandler extends SimpleUrlAuthenticationSuc
returnStatus = "root not allow login";
//单点登录认证成功直接跳转首页
response.sendRedirect("/go");
response.sendRedirect(go);
PrintWriter writer = response.getWriter();
writer.write(returnStatus);
......
......@@ -41,8 +41,8 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
private RESTAuthenticationFailureHandler authenticationFailureHandler;
@Autowired
private RESTAuthenticationSuccessHandler authenticationSuccessHandler;
// @Autowired
// private RESTLogoutSuccessHandler logoutSuccessHandler;
@Autowired
private RESTLogoutSuccessHandler logoutSuccessHandler;
@Autowired
private AuthService authService;
......@@ -58,7 +58,17 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests().anyRequest().permitAll();
http.csrf().disable();
http.exceptionHandling().authenticationEntryPoint(authenticationEntryPoint);
http.formLogin().successHandler(authenticationSuccessHandler);
http.formLogin().failureHandler(authenticationFailureHandler);
http.formLogin().loginPage("/login");
http.formLogin().loginProcessingUrl("/signin");
http.logout().logoutUrl("/signout");
http.logout().logoutSuccessHandler(logoutSuccessHandler);
http.sessionManagement().maximumSessions(1).expiredUrl("/login");
}
public static String baseUrl="http://cas.zua.edu.cn/oauth2.0/authorize?response_type=code&client_id=tVnAsJna9Y&redirect_uri=http://10.60.60.127:8091/api/auth/sso";
......
......@@ -27,9 +27,9 @@ spring:
testWhileIdle: true #在空闲时检查有效性, 默认false
password:
datasource:
url: jdbc:mysql://192.168.0.192:3306/sdrcb?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8
username: test
password: test
url: jdbc:mysql://139.198.127.54:9306/dev0?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8
username: root
password: dataSharing
hikari:
maximum-pool-size: 3
mvc:
......@@ -44,6 +44,7 @@ eureka:
registryFetchIntervalSeconds: 5
serviceUrl:
defaultZone: http://192.168.0.41:8081/eureka/
enabled: false
zuul:
prefix: /api
......@@ -59,6 +60,7 @@ security:
sso:
url: http://localhost:8764/token
go: http://localhost:8764/token
client:
id: tVnAsJna9Y
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment