|
@@ -20,6 +20,7 @@ import com.persagy.common.constant.SaasCommonConstant;
|
|
|
import com.persagy.common.enums.ResponseCode;
|
|
|
import com.persagy.common.exception.BusinessException;
|
|
|
import com.persagy.common.utils.StringUtil;
|
|
|
+import com.persagy.security.constant.CipherConstants;
|
|
|
|
|
|
import cn.hutool.core.util.BooleanUtil;
|
|
|
import cn.hutool.crypto.digest.MD5;
|
|
@@ -76,7 +77,7 @@ public class SaasAuthHandler {
|
|
|
}
|
|
|
groupCode = allowGroupCode;
|
|
|
}
|
|
|
- result.put(SaasCommonConstant.GROUP_CODE, groupCode);
|
|
|
+ result.put(CipherConstants.GROUP_CODE, groupCode);
|
|
|
result.put(SaasCommonConstant.ACCOUNT_TYPE, accountType);
|
|
|
result.put(SaasCommonConstant.ACCOUNT_BELONG, account.getAccountBelong());
|
|
|
return result;
|
|
@@ -92,7 +93,7 @@ public class SaasAuthHandler {
|
|
|
public List<SaasGroup> getAllowGroupList(String accountId, String groupCode) {
|
|
|
// 获取此账号对应的集团权限
|
|
|
Map<String, String> accountAuth = this.validAccountAuth(accountId, groupCode);
|
|
|
- groupCode = accountAuth.get(SaasCommonConstant.GROUP_CODE);
|
|
|
+ groupCode = accountAuth.get(CipherConstants.GROUP_CODE);
|
|
|
String accountType = accountAuth.get(SaasCommonConstant.ACCOUNT_TYPE);
|
|
|
return this.getAllowGroupList(accountId, groupCode, accountType);
|
|
|
}
|
|
@@ -129,7 +130,7 @@ public class SaasAuthHandler {
|
|
|
public List<SaasArea> getAllowAreaList(String accountId, String groupCode) {
|
|
|
// 获取此账号对应的集团权限
|
|
|
Map<String, String> accountAuth = this.validAccountAuth(accountId, groupCode);
|
|
|
- groupCode = accountAuth.get(SaasCommonConstant.GROUP_CODE);
|
|
|
+ groupCode = accountAuth.get(CipherConstants.GROUP_CODE);
|
|
|
String accountType = accountAuth.get(SaasCommonConstant.ACCOUNT_TYPE);
|
|
|
return this.getAllowAreaList(accountId, groupCode, accountType);
|
|
|
}
|
|
@@ -174,9 +175,9 @@ public class SaasAuthHandler {
|
|
|
throw new BusinessException(ResponseCode.A0001.getCode(), "非法客户端");
|
|
|
}
|
|
|
// 设置账号相关信息
|
|
|
- this.redisTemplate.opsForHash().put(clientId, SaasCommonConstant.APP_ID_REDIS_HASH_KEY, appId);
|
|
|
- this.redisTemplate.opsForHash().put(clientId, SaasCommonConstant.ACCOUNT_ID_REDIS_HASH_KEY, accountId);
|
|
|
- this.redisTemplate.opsForHash().put(clientId, SaasCommonConstant.GROUP_CODE_REDIS_HASH_KEY, groupCode);
|
|
|
+ this.redisTemplate.opsForHash().put(clientId, CipherConstants.APP_ID_HASH_KEY, appId);
|
|
|
+ this.redisTemplate.opsForHash().put(clientId, CipherConstants.ACCOUNT_ID_HASH_KEY, accountId);
|
|
|
+ this.redisTemplate.opsForHash().put(clientId, CipherConstants.GROUP_CODE_HASH_KEY, groupCode);
|
|
|
|
|
|
// 生成新的授权码,并验证授权码是否已存在
|
|
|
JSONObject temp = new JSONObject();
|
|
@@ -184,7 +185,7 @@ public class SaasAuthHandler {
|
|
|
temp.put("redirectUrl", redirectUrl);
|
|
|
temp.put("clientId", clientId);
|
|
|
String code = md5.digestHex(temp.toJSONString());
|
|
|
- this.redisTemplate.opsForHash().put(clientId, SaasCommonConstant.CODE_REDIS_HASH_KEY, code);
|
|
|
+ this.redisTemplate.opsForHash().put(clientId, CipherConstants.CODE_HASH_KEY, code);
|
|
|
return code;
|
|
|
}
|
|
|
|
|
@@ -200,11 +201,11 @@ public class SaasAuthHandler {
|
|
|
return true;
|
|
|
}
|
|
|
// 判断是否为内部客户端,内部不校验url
|
|
|
- Boolean inner = (Boolean)this.redisTemplate.opsForHash().get(clientId, SaasCommonConstant.INNER_CLIENT_REDIS_HASH_KEY);
|
|
|
+ Boolean inner = (Boolean)this.redisTemplate.opsForHash().get(clientId, CipherConstants.INNER_CLIENT_HASH_KEY);
|
|
|
if (BooleanUtil.isTrue(inner)) {
|
|
|
return true;
|
|
|
}
|
|
|
- Object object = this.redisTemplate.opsForHash().get(clientId, SaasCommonConstant.REDIRECT_URL_REDIS_HASH_KEY);
|
|
|
+ Object object = this.redisTemplate.opsForHash().get(clientId, CipherConstants.REDIRECT_URL_HASH_KEY);
|
|
|
if(object == null) {
|
|
|
return false;
|
|
|
}
|