Commit 76de4ec6 by huangkp

ad认证

parent 33944ab7
......@@ -19,14 +19,14 @@ public class SSOCtrl {
// @Value("${sso.url}")
// private String ssoUrl;
@Value("${redirect-url.data-platform}")
private String dataPlatformURL;
@Value("${redirect-url.indicator}")
private String indicatorUrl;
@GetMapping("/go")
public String doJump(Map<String, Object> model) {
model.put("success", true);
model.put("redirect-url", dataPlatformURL);
model.put("redirect-url", indicatorUrl);
model.put("msg", "验证成功");
return "main";
}
......
......@@ -17,8 +17,8 @@ public class ServiceInfo {
@Value("${server.port}")
private int port;
@Value("${redirect-url.system-management}")
private String managementSystemUrl;
@Value("${redirect-url.indicator}")
private String indicatorUrl;
@RequestMapping(value = "/port", method = RequestMethod.GET)
public Integer getPort() {
......@@ -49,7 +49,7 @@ public class ServiceInfo {
@GetMapping("/manager-url")
public String getManagementSystemUrl(HttpServletResponse response) {
response.setContentType("text/plain;charset=utf-8");
return managementSystemUrl;
return indicatorUrl;
}
}
......@@ -110,7 +110,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
String key = httpServletRequest.getParameter("key");
if(null == username || null == portal_password ||
null == CallBack ||null == key){
httpServletResponse.sendError(500,"sso login url missing request param");
httpServletResponse.sendError(200,"sso login url missing request param");
return null;
}
if (authAdLogin) {
......@@ -118,7 +118,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
String pwd = des.strDec(portal_password, key);
logger.info("sso login param->userName:"+username+" pwd:"+pwd);
if(!authenticate(username,pwd)){
httpServletResponse.sendError(500,CallBack+"({'query':{'results':{'postresult':'portal_ssologin_fali'}}});");
httpServletResponse.sendError(200,CallBack+"({'query':{'results':{'postresult':'portal_ssologin_fali'}}});");
return null;
}
}
......@@ -126,13 +126,13 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
com.keymobile.proxy.model.User user = portalService.getUserByUserId(username);
if (user == null) {
logger.error(username + " is not exit");
httpServletResponse.sendError(500,CallBack+"({'query':{'results':{'postresult':'portal_ssologin_fali'}}});");
httpServletResponse.sendError(200,CallBack+"({'query':{'results':{'postresult':'portal_ssologin_fali'}}});");
return null;
}
if (! authAdLogin) {
if (! StringUtils.equals(user.getPassword(), portal_password)) {
logger.error(username + " password:" + portal_password + " is error");
httpServletResponse.sendError(500,CallBack+"({'query':{'results':{'postresult':'portal_ssologin_fali'}}});");
httpServletResponse.sendError(200,CallBack+"({'query':{'results':{'postresult':'portal_ssologin_fali'}}});");
return null;
}
}
......@@ -145,7 +145,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
authorities.add(authorityInfo);
}
}
return new UsernamePasswordAuthenticationToken(new User(userName, "whatever", authorities), null, authorities);
return new UsernamePasswordAuthenticationToken(new User(userName, user.getPassword(), authorities), null, authorities);
}
};
authenticationFilter.setAuthenticationManager(authenticationManager());
......
......@@ -47,5 +47,11 @@ logging:
config: classpath:logback-custom.xml
redirect-url:
system-management: http://192.168.0.216:9090/center-home/view/index
data-platform: http://192.168.0.216:9090/center-home/view/index
\ No newline at end of file
indicator: http://139.198.127.54:18580/hndb/view/index
ad-authenticate:
domain: hntobacco.com
provider-url: ldap://hntobacco.com:389
auth-login:
adAuth: false
\ No newline at end of file
......@@ -2,7 +2,7 @@ spring:
application:
name: auth
profiles:
active: test
active: local
# cloud:
# config:
# uri: http://localhost:8082
\ No newline at end of file
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