Commit d6bfa9c1 by chenzx

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

parent bcb3b51f
...@@ -22,6 +22,8 @@ public class RESTAuthenticationSuccessHandler extends SimpleUrlAuthenticationSuc ...@@ -22,6 +22,8 @@ public class RESTAuthenticationSuccessHandler extends SimpleUrlAuthenticationSuc
@Value("${security.allowRootLogin:true}") @Value("${security.allowRootLogin:true}")
private boolean rootAllowLogin = true; private boolean rootAllowLogin = true;
@Value("${sso.go}")
private String go;
@Override @Override
public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response, public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response,
...@@ -37,7 +39,7 @@ public class RESTAuthenticationSuccessHandler extends SimpleUrlAuthenticationSuc ...@@ -37,7 +39,7 @@ public class RESTAuthenticationSuccessHandler extends SimpleUrlAuthenticationSuc
returnStatus = "root not allow login"; returnStatus = "root not allow login";
//单点登录认证成功直接跳转首页 //单点登录认证成功直接跳转首页
response.sendRedirect("/go"); response.sendRedirect(go);
PrintWriter writer = response.getWriter(); PrintWriter writer = response.getWriter();
writer.write(returnStatus); writer.write(returnStatus);
......
...@@ -41,8 +41,8 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter { ...@@ -41,8 +41,8 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
private RESTAuthenticationFailureHandler authenticationFailureHandler; private RESTAuthenticationFailureHandler authenticationFailureHandler;
@Autowired @Autowired
private RESTAuthenticationSuccessHandler authenticationSuccessHandler; private RESTAuthenticationSuccessHandler authenticationSuccessHandler;
// @Autowired @Autowired
// private RESTLogoutSuccessHandler logoutSuccessHandler; private RESTLogoutSuccessHandler logoutSuccessHandler;
@Autowired @Autowired
private AuthService authService; private AuthService authService;
...@@ -58,7 +58,17 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter { ...@@ -58,7 +58,17 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Override @Override
protected void configure(HttpSecurity http) throws Exception { protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests().anyRequest().permitAll();
http.csrf().disable(); 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"; 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: ...@@ -27,9 +27,9 @@ spring:
testWhileIdle: true #在空闲时检查有效性, 默认false testWhileIdle: true #在空闲时检查有效性, 默认false
password: password:
datasource: datasource:
url: jdbc:mysql://192.168.0.192:3306/sdrcb?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8 url: jdbc:mysql://139.198.127.54:9306/dev0?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8
username: test username: root
password: test password: dataSharing
hikari: hikari:
maximum-pool-size: 3 maximum-pool-size: 3
mvc: mvc:
...@@ -44,6 +44,7 @@ eureka: ...@@ -44,6 +44,7 @@ eureka:
registryFetchIntervalSeconds: 5 registryFetchIntervalSeconds: 5
serviceUrl: serviceUrl:
defaultZone: http://192.168.0.41:8081/eureka/ defaultZone: http://192.168.0.41:8081/eureka/
enabled: false
zuul: zuul:
prefix: /api prefix: /api
...@@ -59,6 +60,7 @@ security: ...@@ -59,6 +60,7 @@ security:
sso: sso:
url: http://localhost:8764/token url: http://localhost:8764/token
go: http://localhost:8764/token
client: client:
id: tVnAsJna9Y 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