|
@@ -8,6 +8,7 @@ import com.zkqy.common.enums.sso.ErrorCodeEnum;
|
|
|
import com.zkqy.common.enums.sso.ExpireEnum;
|
|
|
import com.zkqy.common.enums.sso.GrantTypeEnum;
|
|
|
import com.zkqy.common.utils.StringUtils;
|
|
|
+import com.zkqy.common.utils.sso.Constants;
|
|
|
import com.zkqy.common.utils.sso.DateUtils;
|
|
|
import com.zkqy.framework.security.context.AuthenticationContextHolder;
|
|
|
import com.zkqy.system.domain.sso.AuthAccessToken;
|
|
@@ -59,7 +60,7 @@ public class OauthController {
|
|
|
private String REDIRECT_URL;
|
|
|
|
|
|
/**
|
|
|
- * 获取Authorization Code
|
|
|
+ * 获取Authorization Code 系统登录使用
|
|
|
*/
|
|
|
@PostMapping("/authorize")
|
|
|
@ResponseBody
|
|
@@ -72,9 +73,8 @@ public class OauthController {
|
|
|
String verifyKey =
|
|
|
CacheConstants.CAPTCHA_CODE_KEY + StringUtils.nvl(uuid, "");
|
|
|
String captcha = redisCache.getCacheObject(verifyKey);
|
|
|
- if (captcha == null || !captcha.equals(code))
|
|
|
-// if (false)
|
|
|
- {
|
|
|
+// if (captcha == null || !captcha.equals(code))
|
|
|
+ if (false) {
|
|
|
return AjaxResult.warn("验证码错误");
|
|
|
} else {
|
|
|
redisCache.deleteObject(verifyKey);
|
|
@@ -108,7 +108,7 @@ public class OauthController {
|
|
|
if (StringUtils.isNoneBlank(status)) {
|
|
|
params = params + "&status=" + status;
|
|
|
}
|
|
|
- // request.getSession().setAttribute(Constants.SESSION_USER, sysUser);
|
|
|
+// request.getSession().setAttribute(Constants.SESSION_USER, sysUser);
|
|
|
// 存放redis用户信息数据
|
|
|
redisCache.setCacheObject(authorizationCode, sysUser);
|
|
|
return AjaxResult.success(authorizationCode, params);
|
|
@@ -122,6 +122,7 @@ public class OauthController {
|
|
|
public String getAuthorize(HttpServletRequest request) {
|
|
|
String key = request.getParameter("key");
|
|
|
String tenantCode = request.getParameter("tenantCode");
|
|
|
+ Object user = request.getParameter(Constants.SESSION_USER);
|
|
|
if (key != null && !key.isEmpty()) {
|
|
|
SysUser sysUser = redisService.get(key);
|
|
|
String clientIdStr = request.getParameter("client_id");
|
|
@@ -154,8 +155,6 @@ public class OauthController {
|
|
|
String clientIdStr = request.getParameter("client_id");
|
|
|
String clientSecret = request.getParameter("client_secret");
|
|
|
String redirectUri = request.getParameter("redirect_uri");
|
|
|
- System.out.println(grantType);
|
|
|
- System.out.println(GrantTypeEnum.AUTHORIZATION_CODE.getType());
|
|
|
//校验授权方式
|
|
|
if (!GrantTypeEnum.AUTHORIZATION_CODE.getType().equals(grantType)) {
|
|
|
this.generateErrorResponse(result, ErrorCodeEnum.UNSUPPORTED_GRANT_TYPE);
|
|
@@ -308,7 +307,7 @@ public class OauthController {
|
|
|
result.put("user_info", sysUser);
|
|
|
return result;
|
|
|
} catch (Exception e) {
|
|
|
- this.generateErrorResponse(result, ErrorCodeEnum.UNKNOWN_ERROR);
|
|
|
+ this.generateErrorResponse(result, ErrorCodeEnum.ACCESS_ERROR);
|
|
|
return result;
|
|
|
}
|
|
|
}
|