优化代码

pull/14/head
yzyunzhang 2023-02-07 09:08:09 +00:00 committed by smallbun
parent 5cb334a502
commit 46c3dba060
76 changed files with 149 additions and 86 deletions

View File

@ -72,7 +72,7 @@ import static cn.topiam.employee.common.enums.IdentityProviderType.DINGTALK_OAUT
*/ */
@SuppressWarnings("DuplicatedCode") @SuppressWarnings("DuplicatedCode")
public class DingtalkOauthAuthenticationFilter extends AbstractIdpAuthenticationProcessingFilter { public class DingtalkOauthAuthenticationFilter extends AbstractIdpAuthenticationProcessingFilter {
public final static String DEFAULT_FILTER_PROCESSES_URI = DINGTALK_OAUTH public static final String DEFAULT_FILTER_PROCESSES_URI = DINGTALK_OAUTH
.getLoginPathPrefix() + "/*"; .getLoginPathPrefix() + "/*";
/** /**
* AntPathRequestMatcher * AntPathRequestMatcher

View File

@ -65,7 +65,9 @@ import cn.topiam.employee.core.context.ServerContextHelp;
import cn.topiam.employee.support.exception.TopIamException; import cn.topiam.employee.support.exception.TopIamException;
import cn.topiam.employee.support.trace.TraceUtils; import cn.topiam.employee.support.trace.TraceUtils;
import cn.topiam.employee.support.util.HttpUrlUtils; import cn.topiam.employee.support.util.HttpUrlUtils;
import static cn.topiam.employee.authentication.dingtalk.constant.DingTalkAuthenticationConstants.*; import static cn.topiam.employee.authentication.dingtalk.constant.DingTalkAuthenticationConstants.GET_USERINFO_BY_CODE;
import static cn.topiam.employee.authentication.dingtalk.constant.DingTalkAuthenticationConstants.GET_USERINFO_BY_USERID;
import static cn.topiam.employee.authentication.dingtalk.constant.DingTalkAuthenticationConstants.GET_USERID_BY_UNIONID;
import static cn.topiam.employee.authentication.dingtalk.filter.DingtalkScanCodeAuthorizationRequestGetFilter.PROVIDER_ID; import static cn.topiam.employee.authentication.dingtalk.filter.DingtalkScanCodeAuthorizationRequestGetFilter.PROVIDER_ID;
import static cn.topiam.employee.common.enums.IdentityProviderType.DINGTALK_SCAN_CODE; import static cn.topiam.employee.common.enums.IdentityProviderType.DINGTALK_SCAN_CODE;
@ -80,7 +82,7 @@ import static cn.topiam.employee.common.enums.IdentityProviderType.DINGTALK_SCAN
@SuppressWarnings("DuplicatedCode") @SuppressWarnings("DuplicatedCode")
public class DingtalkScanCodeAuthenticationFilter extends public class DingtalkScanCodeAuthenticationFilter extends
AbstractIdpAuthenticationProcessingFilter { AbstractIdpAuthenticationProcessingFilter {
public final static String DEFAULT_FILTER_PROCESSES_URI = DINGTALK_SCAN_CODE public static final String DEFAULT_FILTER_PROCESSES_URI = DINGTALK_SCAN_CODE
.getLoginPathPrefix() + "/*"; .getLoginPathPrefix() + "/*";
/** /**
* AntPathRequestMatcher * AntPathRequestMatcher

View File

@ -67,7 +67,7 @@ import static cn.topiam.employee.portal.idp.qq.constant.QqAuthenticationConstant
@SuppressWarnings({ "AlibabaClassNamingShouldBeCamel", "DuplicatedCode" }) @SuppressWarnings({ "AlibabaClassNamingShouldBeCamel", "DuplicatedCode" })
public class QqOAuth2LoginAuthenticationFilter extends AbstractIdpAuthenticationProcessingFilter { public class QqOAuth2LoginAuthenticationFilter extends AbstractIdpAuthenticationProcessingFilter {
final String ERROR_CODE = "error"; final String ERROR_CODE = "error";
public final static String DEFAULT_FILTER_PROCESSES_URI = QQ.getLoginPathPrefix() public static final String DEFAULT_FILTER_PROCESSES_URI = QQ.getLoginPathPrefix()
+ "/*"; + "/*";
public static final AntPathRequestMatcher REQUEST_MATCHER = new AntPathRequestMatcher( public static final AntPathRequestMatcher REQUEST_MATCHER = new AntPathRequestMatcher(
QQ.getLoginPathPrefix() + "/" + "{" + PROVIDER_ID + "}", HttpMethod.GET.name()); QQ.getLoginPathPrefix() + "/" + "{" + PROVIDER_ID + "}", HttpMethod.GET.name());

View File

@ -59,7 +59,7 @@ public class SmsAuthenticationFilter extends AbstractAuthenticationProcessingFil
*/ */
private boolean postOnly = true; private boolean postOnly = true;
public final static String DEFAULT_FILTER_PROCESSES_URI = SMS_LOGIN; public static final String DEFAULT_FILTER_PROCESSES_URI = SMS_LOGIN;
public static final RequestMatcher SMS_LOGIN_MATCHER = new AntPathRequestMatcher( public static final RequestMatcher SMS_LOGIN_MATCHER = new AntPathRequestMatcher(
DEFAULT_FILTER_PROCESSES_URI, HttpMethod.POST.name()); DEFAULT_FILTER_PROCESSES_URI, HttpMethod.POST.name());

View File

@ -51,7 +51,10 @@ import com.google.common.collect.Sets;
import cn.topiam.employee.authentication.wechat.WeChatIdpScanCodeConfig; import cn.topiam.employee.authentication.wechat.WeChatIdpScanCodeConfig;
import cn.topiam.employee.common.entity.authentication.IdentityProviderEntity; import cn.topiam.employee.common.entity.authentication.IdentityProviderEntity;
import cn.topiam.employee.common.repository.authentication.IdentityProviderRepository; import cn.topiam.employee.common.repository.authentication.IdentityProviderRepository;
import static cn.topiam.employee.authentication.wechat.constant.WeChatAuthenticationConstants.*; import static cn.topiam.employee.authentication.wechat.constant.WeChatAuthenticationConstants.APP_ID;
import static cn.topiam.employee.authentication.wechat.constant.WeChatAuthenticationConstants.AUTHORIZATION_REQUEST;
import static cn.topiam.employee.authentication.wechat.constant.WeChatAuthenticationConstants.HREF;
import static cn.topiam.employee.authentication.wechat.constant.WeChatAuthenticationConstants.SNSAPI_LOGIN;
import static cn.topiam.employee.common.enums.IdentityProviderType.WECHAT_SCAN_CODE; import static cn.topiam.employee.common.enums.IdentityProviderType.WECHAT_SCAN_CODE;
/** /**
@ -160,13 +163,13 @@ public class WeChatScanCodeAuthorizationRequestRedirectFilter extends OncePerReq
authorizationRequest.getAuthorizationRequestUri()); authorizationRequest.getAuthorizationRequestUri());
} }
private final static String STYLE = "" private static final String STYLE = ""
+ ".impowerBox .qrcode {width: 280px;border: none;margin-top:10px;}\n" + ".impowerBox .qrcode {width: 280px;border: none;margin-top:10px;}\n"
+ ".impowerBox .title {display: none;}\n" + ".impowerBox .title {display: none;}\n"
+ ".impowerBox .info {display: none;}\n" + ".impowerBox .info {display: none;}\n"
+ ".status_icon {display: none}\n" + ".status_icon {display: none}\n"
+ ".impowerBox .status {text-align: center;} "; + ".impowerBox .status {text-align: center;} ";
private final static String STYLE_BASE64 = "data:text/css;base64," + Base64.getEncoder() private static final String STYLE_BASE64 = "data:text/css;base64," + Base64.getEncoder()
.encodeToString(STYLE.getBytes(StandardCharsets.UTF_8)); .encodeToString(STYLE.getBytes(StandardCharsets.UTF_8));
public static RequestMatcher getRequestMatcher() { public static RequestMatcher getRequestMatcher() {

View File

@ -44,7 +44,6 @@ import cn.topiam.employee.authentication.common.filter.AbstractIdpAuthentication
import cn.topiam.employee.authentication.common.modal.IdpUser; import cn.topiam.employee.authentication.common.modal.IdpUser;
import cn.topiam.employee.authentication.common.service.UserIdpService; import cn.topiam.employee.authentication.common.service.UserIdpService;
import cn.topiam.employee.authentication.wechat.WeChatIdpScanCodeConfig; import cn.topiam.employee.authentication.wechat.WeChatIdpScanCodeConfig;
import cn.topiam.employee.authentication.wechat.constant.WeChatAuthenticationConstants;
import cn.topiam.employee.common.entity.authentication.IdentityProviderEntity; import cn.topiam.employee.common.entity.authentication.IdentityProviderEntity;
import cn.topiam.employee.common.enums.IdentityProviderType; import cn.topiam.employee.common.enums.IdentityProviderType;
import cn.topiam.employee.common.repository.authentication.IdentityProviderRepository; import cn.topiam.employee.common.repository.authentication.IdentityProviderRepository;
@ -53,7 +52,11 @@ import cn.topiam.employee.support.exception.TopIamException;
import cn.topiam.employee.support.util.HttpClientUtils; import cn.topiam.employee.support.util.HttpClientUtils;
import static org.springframework.security.oauth2.core.AuthorizationGrantType.AUTHORIZATION_CODE; import static org.springframework.security.oauth2.core.AuthorizationGrantType.AUTHORIZATION_CODE;
import static cn.topiam.employee.authentication.wechat.constant.WeChatAuthenticationConstants.*; import static cn.topiam.employee.authentication.wechat.constant.WeChatAuthenticationConstants.ACCESS_TOKEN;
import static cn.topiam.employee.authentication.wechat.constant.WeChatAuthenticationConstants.APP_ID;
import static cn.topiam.employee.authentication.wechat.constant.WeChatAuthenticationConstants.ERROR_CODE;
import static cn.topiam.employee.authentication.wechat.constant.WeChatAuthenticationConstants.SECRET;
import static cn.topiam.employee.authentication.wechat.constant.WeChatAuthenticationConstants.USER_INFO;
import static cn.topiam.employee.authentication.wechat.filter.WeChatScanCodeAuthorizationRequestRedirectFilter.PROVIDER_ID; import static cn.topiam.employee.authentication.wechat.filter.WeChatScanCodeAuthorizationRequestRedirectFilter.PROVIDER_ID;
import static cn.topiam.employee.common.enums.IdentityProviderType.WECHAT_SCAN_CODE; import static cn.topiam.employee.common.enums.IdentityProviderType.WECHAT_SCAN_CODE;
@ -66,7 +69,7 @@ import static cn.topiam.employee.common.enums.IdentityProviderType.WECHAT_SCAN_C
public class WeChatScanCodeLoginAuthenticationFilter extends public class WeChatScanCodeLoginAuthenticationFilter extends
AbstractIdpAuthenticationProcessingFilter { AbstractIdpAuthenticationProcessingFilter {
public final static String DEFAULT_FILTER_PROCESSES_URI = WECHAT_SCAN_CODE public static final String DEFAULT_FILTER_PROCESSES_URI = WECHAT_SCAN_CODE
.getLoginPathPrefix() + "/*"; .getLoginPathPrefix() + "/*";
public static final AntPathRequestMatcher REQUEST_MATCHER = new AntPathRequestMatcher( public static final AntPathRequestMatcher REQUEST_MATCHER = new AntPathRequestMatcher(
WECHAT_SCAN_CODE.getLoginPathPrefix() + "/" + "{" + PROVIDER_ID + "}", WECHAT_SCAN_CODE.getLoginPathPrefix() + "/" + "{" + PROVIDER_ID + "}",
@ -133,8 +136,7 @@ public class WeChatScanCodeLoginAuthenticationFilter extends
param.put(SECRET, config.getAppSecret()); param.put(SECRET, config.getAppSecret());
param.put(OAuth2ParameterNames.CODE, code); param.put(OAuth2ParameterNames.CODE, code);
param.put(OAuth2ParameterNames.GRANT_TYPE, AUTHORIZATION_CODE.getValue()); param.put(OAuth2ParameterNames.GRANT_TYPE, AUTHORIZATION_CODE.getValue());
JSONObject result = JSON JSONObject result = JSON.parseObject(HttpClientUtils.get(ACCESS_TOKEN, param));
.parseObject(HttpClientUtils.get(WeChatAuthenticationConstants.ACCESS_TOKEN, param));
if (result.containsKey(ERROR_CODE)) { if (result.containsKey(ERROR_CODE)) {
logger.error("获取access_token发生错误: " + result.toJSONString()); logger.error("获取access_token发生错误: " + result.toJSONString());
throw new TopIamException("获取access_token发生错误: " + result.toJSONString()); throw new TopIamException("获取access_token发生错误: " + result.toJSONString());
@ -144,8 +146,7 @@ public class WeChatScanCodeLoginAuthenticationFilter extends
param.put(OAuth2ParameterNames.ACCESS_TOKEN, param.put(OAuth2ParameterNames.ACCESS_TOKEN,
result.getString(OAuth2ParameterNames.ACCESS_TOKEN)); result.getString(OAuth2ParameterNames.ACCESS_TOKEN));
param.put(OidcScopes.OPENID, result.getString(OidcScopes.OPENID)); param.put(OidcScopes.OPENID, result.getString(OidcScopes.OPENID));
result = JSON result = JSON.parseObject(HttpClientUtils.get(USER_INFO, param));
.parseObject(HttpClientUtils.get(WeChatAuthenticationConstants.USER_INFO, param));
if (result.containsKey(ERROR_CODE)) { if (result.containsKey(ERROR_CODE)) {
logger.error("获取微信用户个人信息发生错误: " + result.toJSONString()); logger.error("获取微信用户个人信息发生错误: " + result.toJSONString());
throw new TopIamException("获取微信用户个人信息发生错误: " + result.toJSONString()); throw new TopIamException("获取微信用户个人信息发生错误: " + result.toJSONString());

View File

@ -24,14 +24,14 @@ package cn.topiam.employee.authentication.wechatwork.constant;
* Created by support@topiam.cn on 2021/12/9 22:19 * Created by support@topiam.cn on 2021/12/9 22:19
*/ */
public final class WeChatWorkAuthenticationConstants { public final class WeChatWorkAuthenticationConstants {
public final static String APP_ID = "appid"; public static final String APP_ID = "appid";
public final static String AGENT_ID = "agentid"; public static final String AGENT_ID = "agentid";
public final static String HREF = "href"; public static final String HREF = "href";
public final static String LOGIN_TYPE = "login_type"; public static final String LOGIN_TYPE = "login_type";
public final static String JSSDK = "jssdk"; public static final String JSSDK = "jssdk";
public final static String URL_AUTHORIZE = "https://open.work.weixin.qq.com/wwopen/sso/v1/qrConnect"; public static final String URL_AUTHORIZE = "https://open.work.weixin.qq.com/wwopen/sso/v1/qrConnect";
public final static String GET_USER_INFO = "https://qyapi.weixin.qq.com/cgi-bin/user/getuserinfo"; public static final String GET_USER_INFO = "https://qyapi.weixin.qq.com/cgi-bin/user/getuserinfo";
public final static String GET_TOKEN = "https://qyapi.weixin.qq.com/cgi-bin/gettoken"; public static final String GET_TOKEN = "https://qyapi.weixin.qq.com/cgi-bin/gettoken";
} }

View File

@ -149,13 +149,13 @@ public class WeChatWorkScanCodeAuthorizationRequestRedirectFilter extends OncePe
authorizationRequest.getAuthorizationRequestUri()); authorizationRequest.getAuthorizationRequestUri());
} }
private final static String STYLE = "" private static final String STYLE = ""
+ ".impowerBox .qrcode {width: 280px;border: none;margin-top:10px;}\n" + ".impowerBox .qrcode {width: 280px;border: none;margin-top:10px;}\n"
+ ".impowerBox .title {display: none;}\n" + ".impowerBox .title {display: none;}\n"
+ ".impowerBox .info {display: none;}\n" + ".impowerBox .info {display: none;}\n"
+ ".status_icon {display: none}\n" + ".status_icon {display: none}\n"
+ ".impowerBox .status {text-align: center;} "; + ".impowerBox .status {text-align: center;} ";
private final static String STYLE_BASE64 = "data:text/css;base64," + Base64.getEncoder() private static final String STYLE_BASE64 = "data:text/css;base64," + Base64.getEncoder()
.encodeToString(STYLE.getBytes(StandardCharsets.UTF_8)); .encodeToString(STYLE.getBytes(StandardCharsets.UTF_8));
public static RequestMatcher getRequestMatcher() { public static RequestMatcher getRequestMatcher() {

View File

@ -67,7 +67,7 @@ public class WeChatWorkScanCodeLoginAuthenticationFilter extends
AbstractIdpAuthenticationProcessingFilter { AbstractIdpAuthenticationProcessingFilter {
final String ERROR_CODE = "errcode"; final String ERROR_CODE = "errcode";
final String SUCCESS = "0"; final String SUCCESS = "0";
public final static String DEFAULT_FILTER_PROCESSES_URI = WECHATWORK_SCAN_CODE public static final String DEFAULT_FILTER_PROCESSES_URI = WECHATWORK_SCAN_CODE
.getLoginPathPrefix() + "/*"; .getLoginPathPrefix() + "/*";
public static final AntPathRequestMatcher REQUEST_MATCHER = new AntPathRequestMatcher( public static final AntPathRequestMatcher REQUEST_MATCHER = new AntPathRequestMatcher(
WECHATWORK_SCAN_CODE.getLoginPathPrefix() + "/" + "{" + PROVIDER_ID + "}", WECHATWORK_SCAN_CODE.getLoginPathPrefix() + "/" + "{" + PROVIDER_ID + "}",

View File

@ -30,19 +30,19 @@ public final class AccountConstants {
/** /**
* API * API
*/ */
public final static String USER_PATH = API_PATH + "/user"; public static final String USER_PATH = API_PATH + "/user";
/** /**
* API * API
*/ */
public final static String ORGANIZATION_PATH = API_PATH + "/organization"; public static final String ORGANIZATION_PATH = API_PATH + "/organization";
/** /**
* API * API
*/ */
public final static String USER_GROUP_PATH = API_PATH + "/user_group"; public static final String USER_GROUP_PATH = API_PATH + "/user_group";
/** /**
* API * API
*/ */
public final static String IDENTITY_SOURCE_PATH = API_PATH + "/identity_source"; public static final String IDENTITY_SOURCE_PATH = API_PATH + "/identity_source";
/** /**
* *

View File

@ -30,7 +30,7 @@ public final class AnalysisConstants {
/** /**
* API * API
*/ */
public final static String ANALYSIS_PATH = API_PATH + "/analysis"; public static final String ANALYSIS_PATH = API_PATH + "/analysis";
/** /**
* *

View File

@ -31,7 +31,7 @@ public final class AppConstants {
/** /**
* API * API
*/ */
public final static String APP_PATH = API_PATH + "/app"; public static final String APP_PATH = API_PATH + "/app";
/** /**
* *

View File

@ -29,7 +29,7 @@ public final class AuditConstants {
/** /**
* API * API
*/ */
public final static String AUDIT_PATH = API_PATH + "/audit"; public static final String AUDIT_PATH = API_PATH + "/audit";
/** /**
* *

View File

@ -26,7 +26,7 @@ import cn.topiam.employee.support.constant.EiamConstants;
* Created by support@topiam.cn on 2020/7/26 19:07 * Created by support@topiam.cn on 2020/7/26 19:07
*/ */
public final class AuthenticationConstants { public final class AuthenticationConstants {
public final static String AUTHENTICATION_PATH = EiamConstants.API_PATH public static final String AUTHENTICATION_PATH = EiamConstants.API_PATH
+ "/authentication"; + "/authentication";
/** /**

View File

@ -30,7 +30,7 @@ public final class AuthorizeConstants {
* LOGIN * LOGIN
*/ */
public static final String LOGIN_PATH = EiamConstants.API_PATH + "/login"; public static final String LOGIN_PATH = EiamConstants.API_PATH + "/login";
public final static String AUTHORIZE_PATH = EiamConstants.API_PATH + "/authorize"; public static final String AUTHORIZE_PATH = EiamConstants.API_PATH + "/authorize";
public static final String AUTHORIZATION_REQUEST_URI = EiamConstants.API_PATH public static final String AUTHORIZATION_REQUEST_URI = EiamConstants.API_PATH
+ "/authorization"; + "/authorization";
/** /**

View File

@ -73,11 +73,11 @@ public final class ProtocolConstants {
/** /**
* OIDC BASE * OIDC BASE
*/ */
public final static String OIDC_AUTHORIZE_BASE_PATH = AUTHORIZE_PATH + "/" + APP_CODE_VARIABLE; public static final String OIDC_AUTHORIZE_BASE_PATH = AUTHORIZE_PATH + "/" + APP_CODE_VARIABLE;
public final static String OIDC_AUTHORIZE_PATH = OIDC_AUTHORIZE_BASE_PATH + "/oidc"; public static final String OIDC_AUTHORIZE_PATH = OIDC_AUTHORIZE_BASE_PATH + "/oidc";
public final static String OAUTH2_AUTHORIZE_PATH = OIDC_AUTHORIZE_BASE_PATH + "/oauth2"; public static final String OAUTH2_AUTHORIZE_PATH = OIDC_AUTHORIZE_BASE_PATH + "/oauth2";
/** /**
* OpenID Provider metadata. * OpenID Provider metadata.
@ -130,7 +130,7 @@ public final class ProtocolConstants {
/** /**
* SAML2 * SAML2
*/ */
public final static String SAML2_AUTHORIZE_BASE_PATH = AUTHORIZE_PATH + "/saml2/" public static final String SAML2_AUTHORIZE_BASE_PATH = AUTHORIZE_PATH + "/saml2/"
+ APP_CODE_VARIABLE; + APP_CODE_VARIABLE;
/** /**
@ -154,21 +154,21 @@ public final class ProtocolConstants {
/** /**
* cas * cas
*/ */
public final static String CAS_AUTHORIZE_BASE_PATH = AUTHORIZE_PATH + "/cas/" public static final String CAS_AUTHORIZE_BASE_PATH = AUTHORIZE_PATH + "/cas/"
+ APP_CODE_VARIABLE; + APP_CODE_VARIABLE;
/** /**
* cas * cas
*/ */
public final static String CAS_LOGIN_PATH = CAS_AUTHORIZE_BASE_PATH + "/login"; public static final String CAS_LOGIN_PATH = CAS_AUTHORIZE_BASE_PATH + "/login";
/** /*
* cas ticket * cas ticket
*/ */
public final static String CAS_VALIDATE_V1_PATH = CAS_AUTHORIZE_BASE_PATH + "/validate"; public static final String CAS_VALIDATE_V1_PATH = CAS_AUTHORIZE_BASE_PATH + "/validate";
public final static String CAS_VALIDATE_V2_PATH = CAS_AUTHORIZE_BASE_PATH public static final String CAS_VALIDATE_V2_PATH = CAS_AUTHORIZE_BASE_PATH
+ "/serviceValidate"; + "/serviceValidate";
public final static String CAS_VALIDATE_V3_PATH = CAS_AUTHORIZE_BASE_PATH public static final String CAS_VALIDATE_V3_PATH = CAS_AUTHORIZE_BASE_PATH
+ "/p3/serviceValidate"; + "/p3/serviceValidate";
} }

View File

@ -26,7 +26,7 @@ import cn.topiam.employee.support.constant.EiamConstants;
* Created by support@topiam.cn on 2022/6/8 20:12 * Created by support@topiam.cn on 2022/6/8 20:12
*/ */
public final class SessionConstants { public final class SessionConstants {
public final static String SESSION_PATH = EiamConstants.API_PATH + "/session"; public static final String SESSION_PATH = EiamConstants.API_PATH + "/session";
/** /**
* CURRENT_USER * CURRENT_USER

View File

@ -31,7 +31,7 @@ public final class SettingConstants {
/** /**
* API * API
*/ */
public final static String SETTING_PATH = EiamConstants.API_PATH + "/setting"; public static final String SETTING_PATH = EiamConstants.API_PATH + "/setting";
/** /**
* *

View File

@ -29,7 +29,7 @@ public final class StorageConstants {
/** /**
* API * API
*/ */
public final static String STORAGE_PATH = EiamConstants.API_PATH + "/storage"; public static final String STORAGE_PATH = EiamConstants.API_PATH + "/storage";
/** /**
* *

View File

@ -68,6 +68,7 @@ public enum AuthenticationType implements BaseEnum {
throw new NullPointerException("未获取到对应平台"); throw new NullPointerException("未获取到对应平台");
} }
@Override
public String getCode() { public String getCode() {
return code; return code;
} }
@ -76,6 +77,7 @@ public enum AuthenticationType implements BaseEnum {
this.code = code; this.code = code;
} }
@Override
public String getDesc() { public String getDesc() {
return desc; return desc;
} }

View File

@ -76,6 +76,7 @@ public enum CaptchaProviderType implements BaseEnum {
this.desc = desc; this.desc = desc;
} }
@Override
public String getCode() { public String getCode() {
return code; return code;
} }

View File

@ -64,10 +64,12 @@ public enum DataOrigin implements BaseEnum {
this.desc = desc; this.desc = desc;
} }
@Override
public String getCode() { public String getCode() {
return code; return code;
} }
@Override
public String getDesc() { public String getDesc() {
return desc; return desc;
} }

View File

@ -62,10 +62,12 @@ public enum IdentityProviderCategory implements BaseEnum {
this.providers = providers; this.providers = providers;
} }
@Override
public String getCode() { public String getCode() {
return code; return code;
} }
@Override
public String getDesc() { public String getDesc() {
return desc; return desc;
} }

View File

@ -94,6 +94,7 @@ public enum IdentityProviderType implements BaseEnum {
this.desc = desc; this.desc = desc;
} }
@Override
public String getCode() { public String getCode() {
return code; return code;
} }
@ -102,6 +103,7 @@ public enum IdentityProviderType implements BaseEnum {
return name; return name;
} }
@Override
public String getDesc() { public String getDesc() {
return desc; return desc;
} }

View File

@ -61,6 +61,7 @@ public enum Language implements BaseEnum {
return locale; return locale;
} }
@Override
public String getDesc() { public String getDesc() {
return desc; return desc;
} }

View File

@ -52,10 +52,12 @@ public enum MessageCategory implements BaseEnum {
this.desc = desc; this.desc = desc;
} }
@Override
public String getCode() { public String getCode() {
return code; return code;
} }
@Override
public String getDesc() { public String getDesc() {
return desc; return desc;
} }

View File

@ -57,10 +57,12 @@ public enum MfaFactor implements BaseEnum {
this.desc = desc; this.desc = desc;
} }
@Override
public String getCode() { public String getCode() {
return code; return code;
} }
@Override
public String getDesc() { public String getDesc() {
return desc; return desc;
} }

View File

@ -56,10 +56,12 @@ public enum MfaMode implements BaseEnum {
this.desc = desc; this.desc = desc;
} }
@Override
public String getCode() { public String getCode() {
return code; return code;
} }
@Override
public String getDesc() { public String getDesc() {
return desc; return desc;
} }

View File

@ -60,10 +60,12 @@ public enum OrganizationType implements BaseEnum {
this.desc = desc; this.desc = desc;
} }
@Override
public String getCode() { public String getCode() {
return code; return code;
} }
@Override
public String getDesc() { public String getDesc() {
return desc; return desc;
} }

View File

@ -62,10 +62,12 @@ public enum PermissionActionType implements BaseEnum {
this.desc = desc; this.desc = desc;
} }
@Override
public String getCode() { public String getCode() {
return code; return code;
} }
@Override
public String getDesc() { public String getDesc() {
return desc; return desc;
} }

View File

@ -52,10 +52,12 @@ public enum PolicyEffect implements BaseEnum {
this.desc = desc; this.desc = desc;
} }
@Override
public String getCode() { public String getCode() {
return code; return code;
} }
@Override
public String getDesc() { public String getDesc() {
return desc; return desc;
} }

View File

@ -56,10 +56,12 @@ public enum PolicyObjectType implements BaseEnum {
this.desc = desc; this.desc = desc;
} }
@Override
public String getCode() { public String getCode() {
return code; return code;
} }
@Override
public String getDesc() { public String getDesc() {
return desc; return desc;
} }

View File

@ -65,10 +65,12 @@ public enum PolicySubjectType implements BaseEnum {
this.desc = desc; this.desc = desc;
} }
@Override
public String getCode() { public String getCode() {
return code; return code;
} }
@Override
public String getDesc() { public String getDesc() {
return desc; return desc;
} }

View File

@ -110,10 +110,12 @@ public enum SmsType implements BaseEnum {
this.category = category; this.category = category;
} }
@Override
public String getCode() { public String getCode() {
return code; return code;
} }
@Override
public String getDesc() { public String getDesc() {
return desc; return desc;
} }

View File

@ -59,10 +59,12 @@ public enum SyncStatus implements BaseEnum {
this.desc = desc; this.desc = desc;
} }
@Override
public String getCode() { public String getCode() {
return code; return code;
} }
@Override
public String getDesc() { public String getDesc() {
return desc; return desc;
} }

View File

@ -46,10 +46,12 @@ public enum TriggerType implements BaseEnum {
this.desc = desc; this.desc = desc;
} }
@Override
public String getCode() { public String getCode() {
return code; return code;
} }
@Override
public String getDesc() { public String getDesc() {
return desc; return desc;
} }

View File

@ -50,10 +50,12 @@ public enum UserGender implements BaseEnum {
this.desc = desc; this.desc = desc;
} }
@Override
public String getCode() { public String getCode() {
return code; return code;
} }
@Override
public String getDesc() { public String getDesc() {
return desc; return desc;
} }

View File

@ -49,10 +49,12 @@ public enum UserIdType implements BaseEnum {
this.desc = desc; this.desc = desc;
} }
@Override
public String getCode() { public String getCode() {
return code; return code;
} }
@Override
public String getDesc() { public String getDesc() {
return desc; return desc;
} }

View File

@ -66,10 +66,12 @@ public enum UserStatus implements BaseEnum {
this.desc = desc; this.desc = desc;
} }
@Override
public String getCode() { public String getCode() {
return code; return code;
} }
@Override
public String getDesc() { public String getDesc() {
return desc; return desc;
} }

View File

@ -72,6 +72,7 @@ public enum UserType implements BaseEnum {
throw new NullPointerException("未获取到类型"); throw new NullPointerException("未获取到类型");
} }
@Override
public String getCode() { public String getCode() {
return code; return code;
} }
@ -80,6 +81,7 @@ public enum UserType implements BaseEnum {
this.code = code; this.code = code;
} }
@Override
public String getDesc() { public String getDesc() {
return desc; return desc;
} }

View File

@ -54,6 +54,7 @@ public enum AppCertUsingType implements BaseEnum {
this.desc = desc; this.desc = desc;
} }
@Override
public String getCode() { public String getCode() {
return code; return code;
} }

View File

@ -66,6 +66,7 @@ public enum AppProtocol implements BaseEnum {
this.desc = desc; this.desc = desc;
} }
@Override
public String getCode() { public String getCode() {
return code; return code;
} }

View File

@ -59,10 +59,12 @@ public enum AppType implements BaseEnum {
this.desc = desc; this.desc = desc;
} }
@Override
public String getCode() { public String getCode() {
return code; return code;
} }
@Override
public String getDesc() { public String getDesc() {
return desc; return desc;
} }

View File

@ -53,10 +53,12 @@ public enum AuthorizationType implements BaseEnum {
this.desc = desc; this.desc = desc;
} }
@Override
public String getCode() { public String getCode() {
return code; return code;
} }
@Override
public String getDesc() { public String getDesc() {
return desc; return desc;
} }

View File

@ -53,10 +53,12 @@ public enum InitLoginType implements BaseEnum {
this.desc = desc; this.desc = desc;
} }
@Override
public String getCode() { public String getCode() {
return code; return code;
} }
@Override
public String getDesc() { public String getDesc() {
return desc; return desc;
} }

View File

@ -84,6 +84,7 @@ public enum SamlAttributeStatementValueType implements BaseEnum {
return null; return null;
} }
@Override
public String getCode() { public String getCode() {
return code; return code;
} }

View File

@ -80,6 +80,7 @@ public enum IdentitySourceProvider implements BaseEnum {
return null; return null;
} }
@Override
public String getCode() { public String getCode() {
return code; return code;
} }
@ -88,6 +89,7 @@ public enum IdentitySourceProvider implements BaseEnum {
return name; return name;
} }
@Override
public String getDesc() { public String getDesc() {
return desc; return desc;
} }

View File

@ -57,10 +57,12 @@ public enum IdentitySourceActionType implements BaseEnum {
this.desc = desc; this.desc = desc;
} }
@Override
public String getCode() { public String getCode() {
return code; return code;
} }
@Override
public String getDesc() { public String getDesc() {
return desc; return desc;
} }

View File

@ -55,10 +55,12 @@ public enum IdentitySourceObjectType implements BaseEnum {
this.desc = desc; this.desc = desc;
} }
@Override
public String getCode() { public String getCode() {
return code; return code;
} }
@Override
public String getDesc() { public String getDesc() {
return desc; return desc;
} }

View File

@ -25,6 +25,6 @@ import org.slf4j.LoggerFactory;
* Created by support@topiam.cn on 2022/12/30 01:06 * Created by support@topiam.cn on 2022/12/30 01:06
*/ */
public class CasUtils { public class CasUtils {
private final static Logger logger = LoggerFactory.getLogger(CasUtils.class); private static final Logger logger = LoggerFactory.getLogger(CasUtils.class);
} }

View File

@ -61,7 +61,7 @@ import static org.opensaml.saml.common.xml.SAMLConstants.POST_METHOD;
* Created by support@topiam.cn on 2022/5/18 21:54 * Created by support@topiam.cn on 2022/5/18 21:54
*/ */
public class SamlUtils { public class SamlUtils {
private final static Logger logger = LoggerFactory.getLogger(SamlUtils.class); private static final Logger logger = LoggerFactory.getLogger(SamlUtils.class);
private static final AtomicBoolean INITIALIZED = new AtomicBoolean(false); private static final AtomicBoolean INITIALIZED = new AtomicBoolean(false);
/** /**

View File

@ -17,6 +17,8 @@
*/ */
package cn.topiam.employee.core.configuration; package cn.topiam.employee.core.configuration;
import java.time.Duration;
import org.apache.http.client.config.RequestConfig; import org.apache.http.client.config.RequestConfig;
import org.apache.http.impl.nio.client.HttpAsyncClientBuilder; import org.apache.http.impl.nio.client.HttpAsyncClientBuilder;
import org.elasticsearch.client.RestClientBuilder; import org.elasticsearch.client.RestClientBuilder;
@ -24,8 +26,6 @@ import org.springframework.boot.autoconfigure.elasticsearch.RestClientBuilderCus
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import java.time.Duration;
/** /**
* EiamElasticsearchConfiguration * EiamElasticsearchConfiguration
* *

View File

@ -54,7 +54,7 @@ public class PublicSecretEndpoint extends HttpServlet {
public static final String PUBLIC_SECRET_PATH = EiamConstants.API_PATH + "/public_secret"; public static final String PUBLIC_SECRET_PATH = EiamConstants.API_PATH + "/public_secret";
private final static String TYPE = "type"; private static final String TYPE = "type";
/** /**
* key * key

View File

@ -57,7 +57,7 @@ import static cn.topiam.employee.support.constant.EiamConstants.TOPIAM_ENCRYPT_S
public class DecryptRequestBodyAdvice extends RequestBodyAdviceAdapter { public class DecryptRequestBodyAdvice extends RequestBodyAdviceAdapter {
private final Logger logger = LoggerFactory.getLogger(DecryptRequestBodyAdvice.class); private final Logger logger = LoggerFactory.getLogger(DecryptRequestBodyAdvice.class);
private final static String ENCRYPT = "encrypt"; private static final String ENCRYPT = "encrypt";
@Override @Override
public boolean supports(MethodParameter methodParameter, @NonNull Type targetType, public boolean supports(MethodParameter methodParameter, @NonNull Type targetType,

View File

@ -180,7 +180,7 @@ public class OtpContextHelp {
/** /**
* *
*/ */
private final static String SEND_FREQUENTLY = "发送验证码频繁,请稍候重试"; private static final String SEND_FREQUENTLY = "发送验证码频繁,请稍候重试";
/** /**
* code * code

View File

@ -107,6 +107,7 @@ public class DefaultPasswordWeakLibImpl implements PasswordWeakLib {
} }
} }
@Override
public Boolean wordExists(String word) { public Boolean wordExists(String word) {
synchronized (dictionary) { synchronized (dictionary) {
return Boolean.TRUE.equals(dictionary.get(word)); return Boolean.TRUE.equals(dictionary.get(word));

View File

@ -46,7 +46,7 @@ public final class MessageSettingConstants {
/** /**
* *
*/ */
public final static String MAIL_CONTENT_PATH = CLASSPATH_URL_PREFIX public static final String MAIL_CONTENT_PATH = CLASSPATH_URL_PREFIX
+ "mail/content/"; + "mail/content/";
/** /**

View File

@ -25,14 +25,14 @@ package cn.topiam.employee.identitysource.wechatwork.util;
*/ */
public class AesException extends Exception { public class AesException extends Exception {
public final static int VALIDATE_SIGNATURE_ERROR = -40001; public static final int VALIDATE_SIGNATURE_ERROR = -40001;
public final static int PARSE_XML_ERROR = -40002; public static final int PARSE_XML_ERROR = -40002;
public final static int COMPUTE_SIGNATURE_ERROR = -40003; public static final int COMPUTE_SIGNATURE_ERROR = -40003;
public final static int ILLEGAL_AES_KEY = -40004; public static final int ILLEGAL_AES_KEY = -40004;
public final static int VALIDATE_CORP_ID_ERROR = -40005; public static final int VALIDATE_CORP_ID_ERROR = -40005;
public final static int ENCRYPT_AES_ERROR = -40006; public static final int ENCRYPT_AES_ERROR = -40006;
public final static int DECRYPT_AES_ERROR = -40007; public static final int DECRYPT_AES_ERROR = -40007;
public final static int ILLEGAL_BUFFER = -40008; public static final int ILLEGAL_BUFFER = -40008;
private final int code; private final int code;

View File

@ -30,12 +30,12 @@ public class OpenApiConstants {
/** /**
* OpenAPI * OpenAPI
*/ */
public final static String OPEN_API_PATH = API_PATH + "/openapi"; public static final String OPEN_API_PATH = API_PATH + "/openapi";
/** /**
* API * API
*/ */
public final static String OPEN_API_PERMISSION_PATH = API_PATH + "/openapi/permission"; public static final String OPEN_API_PERMISSION_PATH = API_PATH + "/openapi/permission";
/** /**
* *

View File

@ -73,7 +73,7 @@ import static cn.topiam.employee.support.constant.EiamConstants.TOPIAM_BIND_MFA_
*/ */
@Slf4j @Slf4j
public class IdpBindUserAuthenticationFilter extends AbstractAuthenticationProcessingFilter { public class IdpBindUserAuthenticationFilter extends AbstractAuthenticationProcessingFilter {
public final static String DEFAULT_FILTER_PROCESSES_URI = USER_BIND_IDP; public static final String DEFAULT_FILTER_PROCESSES_URI = USER_BIND_IDP;
public static final RequestMatcher IDP_BIND_USER_MATCHER = new AntPathRequestMatcher( public static final RequestMatcher IDP_BIND_USER_MATCHER = new AntPathRequestMatcher(
DEFAULT_FILTER_PROCESSES_URI, HttpMethod.POST.name()); DEFAULT_FILTER_PROCESSES_URI, HttpMethod.POST.name());

View File

@ -60,7 +60,7 @@ public class MfaAuthenticationFilter extends AbstractAuthenticationProcessingFil
public static final String SPRING_SECURITY_FORM_TOTP_KEY = "totp"; public static final String SPRING_SECURITY_FORM_TOTP_KEY = "totp";
public static final String SPRING_SECURITY_FORM_TYPE_KEY = "type"; public static final String SPRING_SECURITY_FORM_TYPE_KEY = "type";
public final static String DEFAULT_FILTER_PROCESSES_URI = MFA_VALIDATE; public static final String DEFAULT_FILTER_PROCESSES_URI = MFA_VALIDATE;
public static final RequestMatcher MFA_LOGIN_MATCHER = new AntPathRequestMatcher( public static final RequestMatcher MFA_LOGIN_MATCHER = new AntPathRequestMatcher(
DEFAULT_FILTER_PROCESSES_URI, HttpMethod.POST.name()); DEFAULT_FILTER_PROCESSES_URI, HttpMethod.POST.name());

View File

@ -49,6 +49,7 @@ public class TicketGrantingTicketImpl implements TicketGrantingTicket {
return false; return false;
} }
@Override
public UserDetails getUserDetails() { public UserDetails getUserDetails() {
return this.userDetails; return this.userDetails;
} }

View File

@ -32,7 +32,7 @@ import org.slf4j.LoggerFactory;
*/ */
public class Response10GeneratorImpl implements ResponseGenerator { public class Response10GeneratorImpl implements ResponseGenerator {
private final static Logger logger = LoggerFactory private static final Logger logger = LoggerFactory
.getLogger(Response20GeneratorImpl.class); .getLogger(Response20GeneratorImpl.class);
private final HttpServletResponse response; private final HttpServletResponse response;

View File

@ -46,7 +46,7 @@ import static cn.topiam.employee.protocol.cas.idp.constant.ProtocolConstants.*;
*/ */
public class Response20GeneratorImpl implements ResponseGenerator { public class Response20GeneratorImpl implements ResponseGenerator {
private final static Logger logger = LoggerFactory private static final Logger logger = LoggerFactory
.getLogger(Response20GeneratorImpl.class); .getLogger(Response20GeneratorImpl.class);
private final HttpServletResponse response; private final HttpServletResponse response;

View File

@ -31,7 +31,7 @@ import org.slf4j.LoggerFactory;
*/ */
public class Response30GeneratorImpl extends Response20GeneratorImpl { public class Response30GeneratorImpl extends Response20GeneratorImpl {
private final static Logger logger = LoggerFactory.getLogger(Response20GeneratorImpl.class); private static final Logger logger = LoggerFactory.getLogger(Response20GeneratorImpl.class);
public Response30GeneratorImpl(DocumentBuilder documentBuilder, HttpServletResponse response) { public Response30GeneratorImpl(DocumentBuilder documentBuilder, HttpServletResponse response) {
super(documentBuilder, response); super(documentBuilder, response);

View File

@ -47,7 +47,7 @@ import static cn.topiam.employee.protocol.oidc.util.EiamOAuth2Utils.getParameter
@SuppressWarnings({ "AlibabaClassNamingShouldBeCamel" }) @SuppressWarnings({ "AlibabaClassNamingShouldBeCamel" })
public class EiamOAuth2AuthorizationPasswordAuthenticationConverter implements public class EiamOAuth2AuthorizationPasswordAuthenticationConverter implements
AuthenticationConverter { AuthenticationConverter {
public final static String DEFAULT_ERROR_URI = "https://datatracker.ietf.org/doc/html/rfc6749#section-5.2"; public static final String DEFAULT_ERROR_URI = "https://datatracker.ietf.org/doc/html/rfc6749#section-5.2";
@Override @Override
public Authentication convert(HttpServletRequest request) { public Authentication convert(HttpServletRequest request) {

View File

@ -38,7 +38,7 @@ public class RedisOAuth2AuthorizationConsentService implements OAuth2Authorizati
private final RedisTemplate<Object, Object> redisTemplate; private final RedisTemplate<Object, Object> redisTemplate;
private final static Long TIMEOUT = 10L; private static final Long TIMEOUT = 10L;
@Override @Override
public void save(OAuth2AuthorizationConsent authorizationConsent) { public void save(OAuth2AuthorizationConsent authorizationConsent) {

View File

@ -47,7 +47,7 @@ import lombok.RequiredArgsConstructor;
@RequiredArgsConstructor @RequiredArgsConstructor
public class RedisOAuth2AuthorizationService implements OAuth2AuthorizationService { public class RedisOAuth2AuthorizationService implements OAuth2AuthorizationService {
private final static Long TIMEOUT = 10L; private static final Long TIMEOUT = 10L;
private static final String AUTHORIZATION = "token"; private static final String AUTHORIZATION = "token";

View File

@ -99,7 +99,7 @@ public class Saml2IdpSingleSignOnEndpointFilter extends OncePerRequestFilter
implements OrderedFilter { implements OrderedFilter {
private static final Logger logger = LoggerFactory private static final Logger logger = LoggerFactory
.getLogger(Saml2IdpSingleSignOnEndpointFilter.class); .getLogger(Saml2IdpSingleSignOnEndpointFilter.class);
private final static RequestMatcher REQUEST_MATCHER = new AntPathRequestMatcher( private static final RequestMatcher REQUEST_MATCHER = new AntPathRequestMatcher(
Saml2EndpointConstants.SAML_SSO_PATH); Saml2EndpointConstants.SAML_SSO_PATH);
private final RedirectCache redirectCache = new HttpSessionRedirectCache(); private final RedirectCache redirectCache = new HttpSessionRedirectCache();
@ -257,7 +257,7 @@ public class Saml2IdpSingleSignOnEndpointFilter extends OncePerRequestFilter
/** /**
* Velocity * Velocity
*/ */
public final static VelocityEngine VELOCITY_ENGINE; public static final VelocityEngine VELOCITY_ENGINE;
static { static {
VELOCITY_ENGINE = new VelocityEngine(); VELOCITY_ENGINE = new VelocityEngine();

View File

@ -73,7 +73,7 @@ public class Saml2IdpSingleSignOutEndpointFilter extends OncePerRequestFilter
private final Logger logger = LoggerFactory private final Logger logger = LoggerFactory
.getLogger(Saml2IdpSingleSignOutEndpointFilter.class); .getLogger(Saml2IdpSingleSignOutEndpointFilter.class);
private final static RequestMatcher REQUEST_MATCHER = new AntPathRequestMatcher( private static final RequestMatcher REQUEST_MATCHER = new AntPathRequestMatcher(
ProtocolConstants.Saml2EndpointConstants.SAML_LOGOUT_PATH); ProtocolConstants.Saml2EndpointConstants.SAML_LOGOUT_PATH);
public static RequestMatcher getRequestMatcher() { public static RequestMatcher getRequestMatcher() {

View File

@ -60,7 +60,7 @@ import static cn.topiam.employee.common.util.SamlUtils.generateSecureRandomId;
@RequiredArgsConstructor @RequiredArgsConstructor
@Getter @Getter
public class AssertionGenerator { public class AssertionGenerator {
private final static Logger logger = LoggerFactory private static final Logger logger = LoggerFactory
.getLogger(AssertionGenerator.class); .getLogger(AssertionGenerator.class);
/** /**

View File

@ -43,7 +43,7 @@ import lombok.RequiredArgsConstructor;
@RequiredArgsConstructor @RequiredArgsConstructor
@Getter @Getter
public class AttributeStatementGenerator { public class AttributeStatementGenerator {
private final static Logger logger = LoggerFactory private static final Logger logger = LoggerFactory
.getLogger(AttributeStatementGenerator.class); .getLogger(AttributeStatementGenerator.class);
/** /**
* *

View File

@ -38,7 +38,7 @@ import cn.topiam.employee.support.context.ServletContextHelp;
* Created by support@topiam.cn on 2022/6/1 22:52 * Created by support@topiam.cn on 2022/6/1 22:52
*/ */
public class AuthnStatementGenerator { public class AuthnStatementGenerator {
private final static Logger logger = LoggerFactory private static final Logger logger = LoggerFactory
.getLogger(AuthnStatementGenerator.class); .getLogger(AuthnStatementGenerator.class);
private final AuthnContextClassRefType authnContextClassRefType; private final AuthnContextClassRefType authnContextClassRefType;

View File

@ -38,7 +38,7 @@ import lombok.AllArgsConstructor;
*/ */
@AllArgsConstructor @AllArgsConstructor
public class ConditionsGenerator { public class ConditionsGenerator {
private final static Logger logger = LoggerFactory.getLogger(ConditionsGenerator.class); private static final Logger logger = LoggerFactory.getLogger(ConditionsGenerator.class);
/** /**
* audienceUri * audienceUri
*/ */

View File

@ -31,7 +31,7 @@ import org.slf4j.LoggerFactory;
*/ */
public class UrlTestUtils { public class UrlTestUtils {
private final static Logger logger = LoggerFactory.getLogger(UrlTestUtils.class); private static final Logger logger = LoggerFactory.getLogger(UrlTestUtils.class);
public static boolean testUrlWithTimeOut(String urlString, int timeOutMillSeconds) { public static boolean testUrlWithTimeOut(String urlString, int timeOutMillSeconds) {
try { try {

View File

@ -30,10 +30,10 @@ public final class SynchronizerConstants {
/** /**
* *
*/ */
public final static String EVENT_PATH = EiamConstants.API_PATH + "/event"; public static final String EVENT_PATH = EiamConstants.API_PATH + "/event";
/** /**
* *
*/ */
public final static String EVENT_RECEIVE_PATH = EVENT_PATH + "/receive"; public static final String EVENT_RECEIVE_PATH = EVENT_PATH + "/receive";
} }