Commit 76de4ec6 by huangkp

ad认证

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