|
|
@ -204,14 +204,6 @@ public class WhiteController extends CoreBaseController {
|
|
|
|
@GetMapping(value = "/auth/{loginStrategy}/sso-login")
|
|
|
|
@GetMapping(value = "/auth/{loginStrategy}/sso-login")
|
|
|
|
@ApiOperation(value = "登录", notes = "登录")
|
|
|
|
@ApiOperation(value = "登录", notes = "登录")
|
|
|
|
public ResultBean ssoLogin(HttpServletRequest request, @PathVariable(name = "loginStrategy") String loginStrategy) throws NoSuchFieldException {
|
|
|
|
public ResultBean ssoLogin(HttpServletRequest request, @PathVariable(name = "loginStrategy") String loginStrategy) throws NoSuchFieldException {
|
|
|
|
try {
|
|
|
|
|
|
|
|
SessionUser sessionUser = AuthUtil.getSessionUser();
|
|
|
|
|
|
|
|
if (sessionUser != null) {
|
|
|
|
|
|
|
|
return new ResultBean(true, AuthUtil.getSession().getId().toString(), AuthUtil.getSessionUser());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
|
|
LOGGER.info("SSO 单点登录 未找到session 跳过");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
String fieldMapping = RedisCacheTool.getSysConfigStrVal(PlatformConstWords.SSO_REQUEST_MAPPING);
|
|
|
|
String fieldMapping = RedisCacheTool.getSysConfigStrVal(PlatformConstWords.SSO_REQUEST_MAPPING);
|
|
|
|
if (StringUtils.isEmpty(fieldMapping)) {
|
|
|
|
if (StringUtils.isEmpty(fieldMapping)) {
|
|
|
|
return ResultBean.fail("请在平台数据库中配置表添加字段映射配置");
|
|
|
|
return ResultBean.fail("请在平台数据库中配置表添加字段映射配置");
|
|
|
@ -223,6 +215,17 @@ public class WhiteController extends CoreBaseController {
|
|
|
|
ValidatorBean.beginValid(loginModel)
|
|
|
|
ValidatorBean.beginValid(loginModel)
|
|
|
|
.notNull("loginStrategy", loginModel.getLoginStrategy())
|
|
|
|
.notNull("loginStrategy", loginModel.getLoginStrategy())
|
|
|
|
.notNull("loginName", loginModel.getLoginName());
|
|
|
|
.notNull("loginName", loginModel.getLoginName());
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
SessionUser sessionUser = AuthUtil.getSessionUser();
|
|
|
|
|
|
|
|
if (sessionUser != null) {
|
|
|
|
|
|
|
|
if (sessionUser.getUserCode().equals(loginModel.getLoginName()) || sessionUser.getUserName().equals(loginModel.getLoginName())) {
|
|
|
|
|
|
|
|
return new ResultBean(true, AuthUtil.getSession().getId().toString(), AuthUtil.getSessionUser());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
|
|
LOGGER.info("SSO 单点登录 未找到session 跳过");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
String beanName = ImppEnumUtil.AUTH_LOGIN_STRATEGY.codeOfStrategyName(loginModel.getLoginStrategy());
|
|
|
|
String beanName = ImppEnumUtil.AUTH_LOGIN_STRATEGY.codeOfStrategyName(loginModel.getLoginStrategy());
|
|
|
|
ISystemLoginStrategyService loginStrategyService = (ISystemLoginStrategyService) SpringContextsUtil.getBean(beanName);
|
|
|
|
ISystemLoginStrategyService loginStrategyService = (ISystemLoginStrategyService) SpringContextsUtil.getBean(beanName);
|
|
|
|
|
|
|
|
|
|
|
|