maxkey-common

This commit is contained in:
MaxKey
2021-02-15 11:02:38 +08:00
parent 9770acf991
commit 6375e38c3d
20 changed files with 0 additions and 1500 deletions

View File

@@ -1,230 +0,0 @@
/*
* Copyright [2020] [MaxKey of copyright http://www.maxkey.top]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.maxkey.configuration;
import org.maxkey.constants.ConstantsProperties;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;
/**
* 全局应用程序配置 包含 1、数据源配置 dataSoruceConfig 2、字符集转换配置 characterEncodingConfig
* 3、webseal认证集成配置 webSealConfig 4、系统的配置 sysConfig 5、所有用户可访问地址配置 allAccessUrl
*
* 其中1、2、3项在applicationContext.xml中配置配置文件applicationConfig.properties
* 4项根据dynamic的属性判断是否动态从sysConfigService动态读取
*
* @author Crystal.Sea
*
*/
@Component
@PropertySource(ConstantsProperties.maxKeyPropertySource)
@PropertySource(ConstantsProperties.applicationPropertySource)
public class ApplicationConfig {
private static final Logger _logger = LoggerFactory.getLogger(ApplicationConfig.class);
@Autowired
EmailConfig emailConfig;
@Autowired
CharacterEncodingConfig characterEncodingConfig;
@Autowired
LoginConfig loginConfig;
@Value("${config.server.basedomain}")
String baseDomainName;
@Value("${config.server.domain}")
String domainName;
@Value("${config.server.name}")
String serverName;
@Value("${config.server.uri}")
String serverPrefix;
@Value("${config.server.default.uri}")
String defaultUri;
@Value("${config.server.management.uri}")
String managementUri;
@Value("${server.port:8080}")
private int port;
@Value("${config.identity.kafkasupport:false}")
private boolean kafkaSupport;
@Value("${config.maxkey.uri}")
private String maxKeyUri;
public int getPort() {
return port;
}
public void setPort(int port) {
this.port = port;
}
public ApplicationConfig() {
super();
}
/**
* @return the characterEncodingConfig
*/
public CharacterEncodingConfig getCharacterEncodingConfig() {
return characterEncodingConfig;
}
/**
* @param characterEncodingConfig the characterEncodingConfig to set
*/
public void setCharacterEncodingConfig(CharacterEncodingConfig characterEncodingConfig) {
this.characterEncodingConfig = characterEncodingConfig;
}
public LoginConfig getLoginConfig() {
return loginConfig;
}
public void setLoginConfig(LoginConfig loginConfig) {
this.loginConfig = loginConfig;
}
public String getServerName() {
return serverName;
}
public void setServerName(String serverName) {
this.serverName = serverName;
}
public String getServerPrefix() {
return serverPrefix;
}
public void setServerPrefix(String serverPrefix) {
this.serverPrefix = serverPrefix;
}
/**
* @return the domainName
*/
public String getDomainName() {
return domainName;
}
/**
* @param domainName the domainName to set
*/
public void setDomainName(String domainName) {
this.domainName = domainName;
}
public String getBaseDomainName() {
return baseDomainName;
}
public void setBaseDomainName(String baseDomainName) {
this.baseDomainName = baseDomainName;
}
/**
* @return the emailConfig
*/
public EmailConfig getEmailConfig() {
return emailConfig;
}
/**
* @param emailConfig the emailConfig to set
*/
public void setEmailConfig(EmailConfig emailConfig) {
this.emailConfig = emailConfig;
}
public String getManagementUri() {
return managementUri;
}
public void setManagementUri(String managementUri) {
this.managementUri = managementUri;
}
public String getDefaultUri() {
return defaultUri;
}
public void setDefaultUri(String defaultUri) {
this.defaultUri = defaultUri;
}
public boolean isKafkaSupport() {
return kafkaSupport;
}
public void setKafkaSupport(boolean kafkaSupport) {
this.kafkaSupport = kafkaSupport;
}
public String getMaxKeyUri() {
return maxKeyUri;
}
public void setMaxKeyUri(String maxKeyUri) {
this.maxKeyUri = maxKeyUri;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("ApplicationConfig [emailConfig=");
builder.append(emailConfig);
builder.append(", characterEncodingConfig=");
builder.append(characterEncodingConfig);
builder.append(", loginConfig=");
builder.append(loginConfig);
builder.append(", baseDomainName=");
builder.append(baseDomainName);
builder.append(", domainName=");
builder.append(domainName);
builder.append(", serverName=");
builder.append(serverName);
builder.append(", serverPrefix=");
builder.append(serverPrefix);
builder.append(", defaultUri=");
builder.append(defaultUri);
builder.append(", managementUri=");
builder.append(managementUri);
builder.append(", port=");
builder.append(port);
builder.append(", kafkaSupport=");
builder.append(kafkaSupport);
builder.append(", maxKeyUri=");
builder.append(maxKeyUri);
builder.append("]");
return builder.toString();
}
}

View File

@@ -1,115 +0,0 @@
/*
* Copyright [2020] [MaxKey of copyright http://www.maxkey.top]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.maxkey.configuration;
import java.io.UnsupportedEncodingException;
import org.maxkey.constants.ConstantsProperties;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
/**
* 字符集转换及转换配置.
*
* @author Crystal.Sea
*
*/
@Configuration
@PropertySource(ConstantsProperties.applicationPropertySource)
public class CharacterEncodingConfig {
/**
* 源字符集.
*/
@Value("${server.servlet.encoding.charset.from:UTF-8}")
String fromCharSet;
/**
* 目标字符集.
*/
@Value("${server.servlet.encoding.charset:UTF-8}")
String toCharSet;
/**
* 转换标志.
*/
@Value("${server.servlet.encoding.enabled:false}")
boolean encoding = false;
public CharacterEncodingConfig() {
}
public String getFromCharSet() {
return fromCharSet;
}
public void setFromCharSet(String fromCharSet) {
this.fromCharSet = fromCharSet;
}
public String getToCharSet() {
return toCharSet;
}
public void setToCharSet(String toCharSet) {
this.toCharSet = toCharSet;
}
public boolean isEncoding() {
return encoding;
}
public void setEncoding(boolean encoding) {
this.encoding = encoding;
}
/**
* 字符集转换.
*
* @param encodingString 源字符串
* @return encoded目标字符串
*/
public String encoding(String encodingString) {
if (!this.encoding || encodingString == null) {
return encodingString;
}
try {
return new String(encodingString.getBytes(this.fromCharSet), this.toCharSet);
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
return null;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("CharacterEncodingConfig [fromCharSet=");
builder.append(fromCharSet);
builder.append(", toCharSet=");
builder.append(toCharSet);
builder.append(", encoding=");
builder.append(encoding);
builder.append("]");
return builder.toString();
}
}

View File

@@ -1,149 +0,0 @@
/*
* Copyright [2020] [MaxKey of copyright http://www.maxkey.top]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.maxkey.configuration;
import org.maxkey.constants.ConstantsProperties;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
@Configuration
@PropertySource(ConstantsProperties.applicationPropertySource)
public class EmailConfig {
@Value("${spring.mail.username}")
private String username;
@Value("${spring.mail.password}")
private String password;
@Value("${spring.mail.host}")
private String smtpHost;
@Value("${spring.mail.port}")
private Integer port;
@Value("${spring.mail.properties.ssl}")
private boolean ssl;
@Value("${spring.mail.properties.sender}")
private String sender;
public EmailConfig() {
}
/*
* @return the username
*/
public String getUsername() {
return username;
}
/*
* @param username the username to set
*/
public void setUsername(String username) {
this.username = username;
}
/*
* @return the password
*/
public String getPassword() {
return password;
}
/*
* @param password the password to set
*/
public void setPassword(String password) {
this.password = password;
}
/*
* @return the smtpHost
*/
public String getSmtpHost() {
return smtpHost;
}
/*
* @param smtpHost the smtpHost to set
*/
public void setSmtpHost(String smtpHost) {
this.smtpHost = smtpHost;
}
public String getSender() {
return sender;
}
public void setSender(String sender) {
this.sender = sender;
}
/*
* @return the port
*/
public Integer getPort() {
return port;
}
/*
* @param port the port to set
*/
public void setPort(Integer port) {
this.port = port;
}
/*
* @return the ssl
*/
public boolean isSsl() {
return ssl;
}
/*
* @param ssl the ssl to set
*/
public void setSsl(boolean ssl) {
this.ssl = ssl;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("EmailConfig [username=");
builder.append(username);
builder.append(", password=");
builder.append(password);
builder.append(", smtpHost=");
builder.append(smtpHost);
builder.append(", port=");
builder.append(port);
builder.append(", ssl=");
builder.append(ssl);
builder.append(", sender=");
builder.append(sender);
builder.append("]");
return builder.toString();
}
}

View File

@@ -1,147 +0,0 @@
/*
* Copyright [2020] [MaxKey of copyright http://www.maxkey.top]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.maxkey.configuration;
import org.maxkey.constants.ConstantsProperties;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
@Configuration
@PropertySource(ConstantsProperties.maxKeyPropertySource)
public class LoginConfig {
@Value("${config.login.captcha}")
boolean captcha;
//验证码类型 text 文本 arithmetic算术验证码
@Value("${config.login.captcha.type:text}")
String captchaType;
@Value("${config.login.mfa}")
boolean mfa;
@Value("${config.login.socialsignon}")
boolean socialSignOn;
@Value("${config.login.kerberos}")
boolean kerberos;
@Value("${config.login.remeberme}")
boolean remeberMe;
@Value("${config.login.wsfederation}")
boolean wsFederation;
@Value("${config.login.default.uri}")
String defaultUri;
/**
* .
*/
public LoginConfig() {
// TODO Auto-generated constructor stub
}
public boolean isCaptcha() {
return captcha;
}
public void setCaptcha(boolean captcha) {
this.captcha = captcha;
}
public boolean isSocialSignOn() {
return socialSignOn;
}
public void setSocialSignOn(boolean socialSignOn) {
this.socialSignOn = socialSignOn;
}
public boolean isKerberos() {
return kerberos;
}
public void setKerberos(boolean kerberos) {
this.kerberos = kerberos;
}
public boolean isMfa() {
return mfa;
}
public void setMfa(boolean mfa) {
this.mfa = mfa;
}
public String getDefaultUri() {
return defaultUri;
}
public void setDefaultUri(String defaultUri) {
this.defaultUri = defaultUri;
}
public boolean isRemeberMe() {
return remeberMe;
}
public void setRemeberMe(boolean remeberMe) {
this.remeberMe = remeberMe;
}
public boolean isWsFederation() {
return wsFederation;
}
public void setWsFederation(boolean wsFederation) {
this.wsFederation = wsFederation;
}
public String getCaptchaType() {
return captchaType;
}
public void setCaptchaType(String captchaType) {
this.captchaType = captchaType;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("LoginConfig [captcha=");
builder.append(captcha);
builder.append(", captchaType=");
builder.append(captchaType);
builder.append(", mfa=");
builder.append(mfa);
builder.append(", socialSignOn=");
builder.append(socialSignOn);
builder.append(", kerberos=");
builder.append(kerberos);
builder.append(", remeberMe=");
builder.append(remeberMe);
builder.append(", wsFederation=");
builder.append(wsFederation);
builder.append(", defaultUri=");
builder.append(defaultUri);
builder.append("]");
return builder.toString();
}
}

View File

@@ -1,57 +0,0 @@
/*
* Copyright [2020] [MaxKey of copyright http://www.maxkey.top]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.maxkey.configuration.oidc;
import java.net.URI;
import java.util.Set;
public interface OIDCProviderMetadata {
public String getIssuer();
public void setIssuer(String issuer);
public URI getAuthorizationEndpoint();
public void setAuthorizationEndpoint(URI authorizationEndpoint);
public URI getTokenEndpoint();
public void setTokenEndpoint(URI tokenEndpoint);
public URI getUserinfoEndpoint();
public void setUserinfoEndpoint(URI userinfoEndpoint);
public URI getJwksUri();
public void setJwksUri(URI jwksUri);
public URI getRegistrationEndpoint();
public void setRegistrationEndpoint(URI registrationEndpoint);
public Set<String> getScopesSupported();
public void setScopesSupported(Set<String> scopesSupported);
public Set<String> getResponseTypesSupported();
public void setResponseTypesSupported(Set<String> responseTypesSupported);
}

View File

@@ -1,151 +0,0 @@
/*
* Copyright [2020] [MaxKey of copyright http://www.maxkey.top]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.maxkey.configuration.oidc;
import java.net.URI;
import java.util.Collection;
import java.util.Iterator;
import java.util.Set;
/**
* OIDCProviderMetadataDetails.
* @author cm
*
*/
public class OIDCProviderMetadataDetails implements OIDCProviderMetadata {
protected String issuer;
protected URI authorizationEndpoint;
protected URI tokenEndpoint;
protected URI userinfoEndpoint;
protected URI jwksUri;
protected URI registrationEndpoint;
protected Set<String> scopesSupported;
protected Set<String> responseTypesSupported;
public String getIssuer() {
return issuer;
}
public void setIssuer(String issuer) {
this.issuer = issuer;
}
public URI getAuthorizationEndpoint() {
return authorizationEndpoint;
}
public void setAuthorizationEndpoint(URI authorizationEndpoint) {
this.authorizationEndpoint = authorizationEndpoint;
}
public URI getTokenEndpoint() {
return tokenEndpoint;
}
public void setTokenEndpoint(URI tokenEndpoint) {
this.tokenEndpoint = tokenEndpoint;
}
public URI getUserinfoEndpoint() {
return userinfoEndpoint;
}
public void setUserinfoEndpoint(URI userinfoEndpoint) {
this.userinfoEndpoint = userinfoEndpoint;
}
public URI getJwksUri() {
return jwksUri;
}
public void setJwksUri(URI jwksUri) {
this.jwksUri = jwksUri;
}
public URI getRegistrationEndpoint() {
return registrationEndpoint;
}
public void setRegistrationEndpoint(URI registrationEndpoint) {
this.registrationEndpoint = registrationEndpoint;
}
public Set<String> getScopesSupported() {
return scopesSupported;
}
public void setScopesSupported(Set<String> scopesSupported) {
this.scopesSupported = scopesSupported;
}
public Set<String> getResponseTypesSupported() {
return responseTypesSupported;
}
public void setResponseTypesSupported(Set<String> responseTypesSupported) {
this.responseTypesSupported = responseTypesSupported;
}
@Override
public String toString() {
final int maxLen = 4;
StringBuilder builder = new StringBuilder();
builder.append("OIDCProviderMetadataDetails [issuer=");
builder.append(issuer);
builder.append(", authorizationEndpoint=");
builder.append(authorizationEndpoint);
builder.append(", tokenEndpoint=");
builder.append(tokenEndpoint);
builder.append(", userinfoEndpoint=");
builder.append(userinfoEndpoint);
builder.append(", jwksUri=");
builder.append(jwksUri);
builder.append(", registrationEndpoint=");
builder.append(registrationEndpoint);
builder.append(", scopesSupported=");
builder.append(scopesSupported != null ? toString(scopesSupported, maxLen) : null);
builder.append(", responseTypesSupported=");
builder.append(responseTypesSupported != null ? toString(responseTypesSupported, maxLen) : null);
builder.append("]");
return builder.toString();
}
private String toString(Collection<?> collection, int maxLen) {
StringBuilder builder = new StringBuilder();
builder.append("[");
int i = 0;
for (Iterator<?> iterator = collection.iterator(); iterator.hasNext() && i < maxLen; i++) {
if (i > 0)
builder.append(", ");
builder.append(iterator.next());
}
builder.append("]");
return builder.toString();
}
// TODO: Complete remaining properties from
// http://openid.net/specs/openid-connect-discovery-1_0.html#ProviderMetadata
}

View File

@@ -1,58 +0,0 @@
/*
* Copyright [2020] [MaxKey of copyright http://www.maxkey.top]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.maxkey.constants;
/**
* Define int for boolean 0 false 1 true.
*
* @author Crystal.Sea
*
*/
public class Boolean {
public static final int FALSE = 0;
public static final int TRUE = 1;
private int value = FALSE;
public Boolean() {
}
public int getValue() {
return value;
}
public boolean isValue() {
return TRUE == value;
}
public void setValue(int value) {
this.value = value;
}
public static boolean isTrue(int value) {
return TRUE == value;
}
public static boolean isFalse(int value) {
return FALSE == value;
}
}

View File

@@ -1,29 +0,0 @@
/*
* Copyright [2020] [MaxKey of copyright http://www.maxkey.top]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.maxkey.constants;
public class ConstantsEntryType {
public static int USERINFO_TYPE = 1;
public static int ORG_TYPE = 2;
public static int GROUP_TYPE = 3;
public static int PASSWORD_TYPE = 4;
public static int RESOURCES_TYPE = 5;
public static int PERMISSIONS_TYPE = 6;
}

View File

@@ -1,37 +0,0 @@
/*
* Copyright [2020] [MaxKey of copyright http://www.maxkey.top]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.maxkey.constants;
public class ConstantsLoginType {
public static final String LOCAL = "Local Login";
public static final String BASIC = "Basic";
public static final String SOCIALSIGNON = "Social Sign On";
public static final String REMEBER_ME = "RemeberMe";
public static final String DESKTOP = "Desktop";
public static final String KERBEROS = "Kerberos";
public static final String SAMLTRUST = "SAML v2.0 Trust";
public static final String MSADTRUST = "MS AD Trust";
public static final String CAS = "CAS";
public static final String WSFEDERATION = "WsFederation";
public static final String JWT = "Jwt";
public static final String HTTPHEADER = "HttpHeader";
}

View File

@@ -1,36 +0,0 @@
/*
* Copyright [2020] [MaxKey of copyright http://www.maxkey.top]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.maxkey.constants;
public final class ConstantsOperateAction {
public static final int CREATE_ACTION = 1;
public static final int DELETE_ACTION = 2;
public static final int UPDATE_ACTION = 3;
public static final int CHANGE_PASSWORD_ACTION = 4;
public static final int ADD_MEMBER_ACTION = 5;
public static final int DELETE_MEMBER_ACTION = 6;
public static final int VIEW_ACTION = 7;
}

View File

@@ -1,31 +0,0 @@
/*
* Copyright [2020] [MaxKey of copyright http://www.maxkey.top]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.maxkey.constants;
public final class ConstantsOperateMessage {
public static final String INSERT_SUCCESS = "message.action.insert.success";
public static final String INSERT_ERROR = "message.action.insert.error";
public static final String UPDATE_SUCCESS = "message.action.update.success";
public static final String UPDATE_ERROR = "message.action.update.error";
public static final String DELETE_SUCCESS = "message.action.delete.success";
public static final String DELETE_ERROR = "message.action.delete.error";
}

View File

@@ -1,35 +0,0 @@
/*
* Copyright [2020] [MaxKey of copyright http://www.maxkey.top]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.maxkey.constants;
/**
* PASSWORDSETTYPE.
* @author Crystal.Sea
*
*/
public final class ConstantsPasswordSetType {
public static final int PASSWORD_NORMAL = 0;
public static final int INITIAL_PASSWORD = 1;
public static final int MANAGER_CHANGED_PASSWORD = 2;
public static final int PASSWORD_EXPIRED = 3;
}

View File

@@ -1,33 +0,0 @@
/*
* Copyright [2020] [MaxKey of copyright http://www.maxkey.top]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.maxkey.constants;
/**
* PROTOCOLS.
* @author Crystal.Sea
*
*/
public final class ConstantsPersistence {
public static final int INMEMORY = 0;
public static final int JDBC = 1;
public static final int REDIS = 2;
}

View File

@@ -1,27 +0,0 @@
/*
* Copyright [2020] [MaxKey of copyright http://www.maxkey.top]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.maxkey.constants;
public final class ConstantsPlatformRole {
public static final String PLATFORM_ADMIN = "PLATFORM_ADMIN";
public static final String TANANT_ADMIN = "TANANT_ADMIN";
public static final String ORDINARY_USER = "ORDINARY_USER";
}

View File

@@ -1,41 +0,0 @@
/*
* Copyright [2020] [MaxKey of copyright http://www.maxkey.top]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.maxkey.constants;
import org.junit.Test;
public class ConstantsProperties {
public static final String applicationPropertySource =
"classpath:/application.properties";
public static final String maxKeyPropertySource =
"classpath:/maxkey.properties";
public static final String kaptchaPropertySource =
"classpath:/kaptcha.properties";
public static String classPathResource(String propertySource) {
return propertySource.replaceAll("classpath:","");
}
@Test
public void classPathResourceTest() {
System.out.println(classPathResource(maxKeyPropertySource));
}
}

View File

@@ -1,48 +0,0 @@
/*
* Copyright [2020] [MaxKey of copyright http://www.maxkey.top]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.maxkey.constants;
/**
* PROTOCOLS.
* @author Crystal.Sea
*
*/
public final class ConstantsProtocols {
public static final String DESKTOP = "Desktop";
public static final String BASIC = "Basic";
public static final String EXTEND_API = "Extend_API";
public static final String FORMBASED = "Form_Based";
public static final String TOKENBASED = "Token_Based";
// OAuth
public static final String OAUTH20 = "OAuth_v2.0";
// SAML
public static final String SAML20 = "SAML_v2.0";
public static final String OPEN_ID_CONNECT = "OpenID_Connect";
public static final String CAS = "CAS";
public static final String JWT = "JWT";
}

View File

@@ -1,137 +0,0 @@
/*
* Copyright [2020] [MaxKey of copyright http://www.maxkey.top]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.maxkey.constants;
public final class ConstantsServiceMessage {
public static final class EMPLOYEES {
public static final String SERVICE_NAME = "employees";
public static final String XE00000001 = "XE00000001";
public static final String XE00000002 = "XE00000002";
public static final String XE00000003 = "XE00000003";
public static final String XE00000004 = "XE00000004";
public static final String XE00000005 = "XE00000005";
public static final String XE00000006 = "XE00000006";
public static final String XE00000007 = "XE00000007";
public static final String XE00000008 = "XE00000008";
public static final String XW00000001 = "XW00000001";
public static final String XW00000002 = "XW00000002";
public static final String XS00000001 = "XS00000001";
public static final String XS00000002 = "XS00000002";
public static final String XS00000003 = "XS00000003";
}
public static final class ENTERPRISES {
public static final String SERVICE_NAME = "enterprises";
public static final String XE00000001 = "XE00000001";
public static final String XE00000002 = "XE00000002";
public static final String XE00000003 = "XE00000003";
public static final String XE00000004 = "XE00000004";
public static final String XE00000005 = "XE00000005";
public static final String XE00000006 = "XE00000006";
public static final String XE00000007 = "XE00000007";
public static final String XE00000008 = "XE00000008";
public static final String XS00000001 = "XS00000001";
public static final String XS00000002 = "XS00000002";
public static final String XS00000003 = "XS00000003";
public static final String XS00000004 = "XS00000004";
}
public static final class RETRIEVEPASSWORD {
public static final String SERVICE_NAME = "retrievepassword";
public static final String XS00000001 = "XS00000001";
public static final String XS00000002 = "XS00000002";
public static final String XE00000001 = "XE00000001";
public static final String XE00000002 = "XE00000002";
public static final String XE00000003 = "XE00000003";
}
public static final class USERCENTER {
public static final String SERVICE_NAME = "usercenter";
public static final String XS00000001 = "XS00000001";
public static final String XS00000002 = "XS00000002";
public static final String XS00000003 = "XS00000003";
public static final String XE00000001 = "XE00000001";
public static final String XE00000002 = "XE00000002";
public static final String XE00000003 = "XE00000003";
}
public static final class APPLICATIONS {
public static final String SERVICE_NAME = "applications";
public static final String XS00000001 = "XS00000001";
public static final String XS00000002 = "XS00000002";
public static final String XS00000003 = "XS00000003";
public static final String XS00000004 = "XS00000004";
public static final String XE00000001 = "XE00000001";
public static final String XE00000002 = "XE00000002";
public static final String XE00000003 = "XE00000003";
public static final String XE00000004 = "XE00000004";
}
public static final class APPROLES {
public static final String SERVICE_NAME = "approles";
public static final String XE00000002 = "XE00000002";
public static final String XS00000002 = "XS00000002";
public static final String XE00000001 = "XE00000001";
public static final String XS00000001 = "XS00000001";
public static final String XE00000003 = "XE00000003";
public static final String XS00000003 = "XS00000003";
public static final String XE00000004 = "XE00000004";
public static final String XS00000004 = "XS00000004";
public static final String XS00000005 = "XS00000005";
public static final String XE00000005 = "XE00000005";
public static final String XE00000006 = "XE00000006";
public static final String XS00000006 = "XS00000006";
public static final String XE00000007 = "XE00000007";
public static final String XS00000007 = "XS00000007";
public static final String XS00000008 = "XS00000008";
public static final String XE00000008 = "XE00000008";
public static final String XE00000009 = "XE00000009";
public static final String XS00000009 = "XS00000009";
}
public static final class APIUSERS {
public static final String SERVICE_NAME = "apiusers";
public static final String XS00000003 = "XS00000003";
public static final String XE00000003 = "XE00000003";
public static final String XW00000001 = "XW00000001";
public static final String XW00000002 = "XW00000002";
public static final String XS00000001 = "XS00000001";
public static final String XE00000001 = "XE00000001";
}
public static final class PASSWORDPOLICY {
public static final String SERVICE_NAME = "passwordpolicy";
public static final String XW00000002 = "XW00000002";
public static final String XW00000001 = "XW00000001";
public static final String XW00000003 = "XW00000003";
public static final String XW00000004 = "XW00000004";
public static final String XW00000005 = "XW00000005";
public static final String XW00000006 = "XW00000006";
public static final String XW00000007 = "XW00000007";
public static final String XW00000008 = "XW00000008";
}
}

View File

@@ -1,49 +0,0 @@
/*
* Copyright [2020] [MaxKey of copyright http://www.maxkey.top]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.maxkey.constants;
public final class ConstantsStatus {
public static final int ACTIVE = 1;
public static final int INACTIVE = 2;
public static final int ENABLED = 3;
public static final int DISABLED = 4;
public static final int LOCK = 5;
public static final int UNLOCK = 6;
public static final int INVALID = 7;
public static final int EXPIRED = 8;
public static final int DELETE = 9;
public static final int VALIDATED = 10;
public static final int START = 11;
public static final int STOP = 12;
public static final int APPROVED = 13;
public static final int QUITED = 14;
}

View File

@@ -1,40 +0,0 @@
/*
* Copyright [2020] [MaxKey of copyright http://www.maxkey.top]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.maxkey.constants;
public final class ConstantsTimeInterval {
public static final Integer ONE_MINUTE = 60; // 1 minutes
public static final Integer ONE_HOUR = 60 * 60; // 1 hour
public static final Integer ONE_DAY = 60 * 60 * 24; // 1 day
public static final Integer ONE_WEEK = ONE_DAY * 7; // 1 week
public static final Integer TWO_WEEK = ONE_DAY * 14; // 2 week
public static final Integer ONE_MONTH = ONE_DAY * 30; // 1 month
public static final Integer TWO_MONTH = ONE_DAY * 60; // 2 month
/**
* The number of seconds in one year (= 60 * 60 * 24 * 365).
*/
public static final Integer ONE_YEAR = 60 * 60 * 24 * 365;
}

View File

@@ -1,50 +0,0 @@
/*
* Copyright [2020] [MaxKey of copyright http://www.maxkey.top]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.maxkey.constants;
public class ContentType {
public static final String TEXT_PLAIN = "text/plain";
public static final String TEXT_PLAIN_UTF8 = "text/plain;charset=UTF-8";
public static final String TEXT_XML = "text/xml";
public static final String TEXT_XML_UTF8 = "text/xml;charset=UTF-8";
public static final String APPLICATION_JSON = "application/json";
public static final String APPLICATION_JSON_UTF8 = "application/json;charset=UTF-8";
public static final String APPLICATION_JWT = "application/jwt";
public static final String APPLICATION_JWT_UTF8 = "application/jwt;charset=UTF-8";
public static final String APPLICATION_XML = "application/xml";
public static final String APPLICATION_XML_UTF8 = "application/xml;charset=UTF-8";
public static final String IMAGE_GIF = "image/gif";
public static final String IMAGE_JPEG = "image/jpeg";
public static final String IMAGE_PNG = "image/png";
}