From 2fdd018239a84670b8426acc0f4124d295c61135 Mon Sep 17 00:00:00 2001 From: "Crystal.Sea" Date: Fri, 24 Sep 2021 14:37:15 +0800 Subject: [PATCH] v3.0.0 --- ReleaseNotes.txt | 8 +- gradle.properties | 14 +- .../JwtAuthnAutoConfiguration.java | 2 +- .../onetimepwd/algorithm/HmacOTP.java | 4 +- .../password/onetimepwd/impl/SmsOtpAuthn.java | 3 - .../otp/algorithm/TimeBasedOTPTest.java | 2 +- .../service/SocialSignOnProviderService.java | 3 +- .../java/org/maxkey/crypto/cert/NameUtil.java | 76 --- .../org/maxkey/crypto/cert/StringUtil.java | 6 +- .../org/maxkey/crypto/cert/X509CertUtils.java | 475 ++---------------- .../org/maxkey/crypto/cert/X509V3CertGen.java | 8 +- ...EncryptionAndDecryptionServiceBuilder.java | 5 - .../service/impl/SymmetricCacheService.java | 3 - ...ricSigningAndValidationServiceBuilder.java | 3 - .../crypto/keystore/KeyStoreLoader.java | 2 - .../maxkey/crypto/keystore/KeyStoreUtil.java | 13 +- .../java/org/maxkey/util/BeanConvert.java | 3 + .../main/java/org/maxkey/util/BeanUtil.java | 9 +- .../main/java/org/maxkey/util/DynaBean.java | 6 +- .../main/java/org/maxkey/util/Instance.java | 4 +- .../java/org/maxkey/util/MethodInvoke.java | 4 +- .../test/java/org/maxkey/Copyright4RZ.java | 193 +++++++ .../org/maxkey/cache/CacheFactoryTest.java | 5 +- .../java/org/maxkey/cache/RandomCache.java | 2 - .../org/maxkey/crypto/Base64UtilsTest.java | 1 - .../org/maxkey/crypto/DigestUtilsTest.java | 3 - .../java/org/maxkey/crypto/Md5SumTest.java | 2 - .../java/org/maxkey/crypto/RSAUtilsTest.java | 6 +- .../maxkey/crypto/ReciprocalUtilsTest.java | 1 - .../maxkey/crypto/cert/X509V3CertGenTest.java | 3 +- .../crypto/signature/DsaSignerTest.java | 1 - .../crypto/signature/RsaSignerTest.java | 1 - .../test/java/org/maxkey/mail/MailTest.java | 1 - .../org/maxkey/otp/algorithm/RQcodeTest.java | 1 + .../java/org/maxkey/util/DateUtilsTest.java | 2 - .../org/maxkey/util/EthernetAddressTest.java | 2 - .../java/org/maxkey/util/MacAddressTest.java | 2 - .../maxkey/util/ObjectTransformerTest.java | 1 - .../java/org/maxkey/util/PathUtilsTest.java | 1 - .../org/maxkey/util/StringGeneratorTest.java | 1 - .../org/maxkey/util/UUIDGeneratorTest.java | 1 - .../java/org/maxkey/util/XMLHelperTest.java | 16 - .../autoconfigure/MvcAutoConfiguration.java | 12 +- .../maxkey/autoconfigure/SwaggerConfig.java | 3 +- .../configuration/ApplicationConfig.java | 5 +- .../org/maxkey/entity/xml/UserInfoXML.java | 1 - .../persistence/redis/RedisConnection.java | 4 +- .../redis/RedisConnectionFactory.java | 2 +- .../maxkey/web/tag/BasePathTagDirective.java | 1 + .../org/maxkey/web/tag/BaseTagDirective.java | 1 + .../maxkey/web/tag/BrowserTagDirective.java | 1 + .../maxkey/web/tag/CurrUrlTagDirective.java | 1 + .../org/maxkey/web/tag/DateTagDirective.java | 8 +- .../maxkey/web/tag/DialogTagDirective.java | 2 +- .../org/maxkey/web/tag/GenIdTagDirective.java | 1 + .../maxkey/web/tag/ParameterTagDirective.java | 1 + .../maxkey/web/tag/PathVarTagDirective.java | 1 + .../maxkey/web/tag/RedirectTagDirective.java | 7 +- .../maxkey/web/tag/StaticTagDirective.java | 1 + .../org/maxkey/web/tag/TreeTagDirective.java | 1 + .../test/java/org/maxkey/EscapeHtml4Test.java | 2 + .../ldap/ActiveDirectoryUtilsTest.java | 2 - .../src/main/resources/application.yml | 2 +- .../ScimOrganizationController.java | 9 +- .../scim/controller/ScimUserController.java | 10 +- .../ScimGroupJsonString2ObjectTest.java | 4 - .../jpa/test/FormBasedDetailsServiceTest.java | 16 +- .../ticket/AbstractTicketException.java | 2 - .../ticket/AbstractWebApplicationService.java | 2 - .../authz/cas/endpoint/ticket/Service.java | 2 +- .../SimpleWebApplicationServiceImpl.java | 2 - .../ticket/generator/InetAddressUtils.java | 6 +- .../authorize/endpoint/RestTestClient.java | 3 +- .../adapter/ExtendApiCndnsApiMailAdapter.java | 3 +- .../adapter/ExtendApiQQExmailAdapter.java | 5 +- .../adapter/ExtendApiZentaoAdapter.java | 1 + .../OAuth2ExceptionJackson2Serializer.java | 5 + .../maxkey/authz/oauth2/jwt/JwtHelper.java | 4 +- .../authz/oauth2/jwt/codec/Base64Codec.java | 5 + .../sign/InvalidSignatureException.java | 5 + .../provider/OAuth2UserDetailsService.java | 2 - .../oauth2/provider/approval/Approval.java | 9 +- .../provider/approval/JdbcApprovalStore.java | 2 +- .../RandomValueAuthorizationCodeServices.java | 3 +- .../provider/endpoint/CheckTokenEndpoint.java | 3 - .../provider/token/RemoteTokenServices.java | 4 +- .../token/store/JwtAccessTokenConverter.java | 6 +- .../provider/token/store/RedisTokenStore.java | 27 +- .../oidc/idtoken/OIDCIdTokenEnhancer.java | 3 +- .../Oauth20AutoConfiguration.java | 2 +- .../src/main/resources/META-INF/MANIFEST.MF | 3 - .../consumer/endpoint/ConsumerEndpoint.java | 8 +- .../authz/saml20/jit/ProvisioningAdapter.java | 6 - .../authz/saml20/xml/SAML2ValidatorSuite.java | 1 - .../Saml20AutoConfiguration.java | 3 + .../src/main/resources/application.properties | 2 +- .../maxkey/web/filter/SingleSignOnFilter.java | 2 - .../contorller/HistoryLoginController.java | 4 - .../interceptor/HistoryLoginAppAdapter.java | 1 - .../web/interceptor/PreLoginAppAdapter.java | 3 +- .../src/main/resources/application.properties | 2 +- .../main/resources/templates/views/index.ftl | 2 +- .../org/maxkey/jobs/DynamicGroupsJob.java | 2 - .../endpoint/RestTimeBasedOtpController.java | 1 - .../contorller/BasicDetailsController.java | 2 - .../ExtendApiDetailsController.java | 2 - .../FormBasedDetailsController.java | 2 - .../contorller/OAuth20DetailsController.java | 2 - .../contorller/SAML20DetailsController.java | 3 +- .../web/contorller/GroupMemberController.java | 1 - .../src/main/resources/application.properties | 2 +- .../main/resources/templates/views/index.ftl | 2 +- .../main/resources/static/css_mgt/base.css | 13 +- settings.gradle | 91 ++-- 114 files changed, 451 insertions(+), 812 deletions(-) delete mode 100644 maxkey-common/src/main/java/org/maxkey/crypto/cert/NameUtil.java create mode 100644 maxkey-common/src/test/java/org/maxkey/Copyright4RZ.java delete mode 100644 maxkey-protocols/maxkey-protocol-oauth-2.0/src/main/resources/META-INF/MANIFEST.MF diff --git a/ReleaseNotes.txt b/ReleaseNotes.txt index 1631b089b..6766553b4 100644 --- a/ReleaseNotes.txt +++ b/ReleaseNotes.txt @@ -24,6 +24,10 @@ *(MAXKEY-210723) mgt登录错误提示信息 *(MAXKEY-210724) 依赖jar引用、更新和升级 spring 5.3.10 + springBoot 2.5.5 + springkafka 2.7.7 + spring-cloud 3.0.4 + springcloudalibabacspl 1.8.2 tomcat 9.0.53 kafkaclients 2.8.1 jibGradlePlugin 3.1.4 @@ -31,10 +35,10 @@ mysqlconnector 8.0.26 jedis 3.7.0 ehcache 3.9.6 - spring-cloud 3.0.3 - springcloudalibabacspl 1.8.2 nacos 2.0.3 + jacksonVersion 2.12.5 httpasyncclient 4.1.4 + JustAuth 1.16.4 MaxKey v 2.9.0 GA 2021/08/24 *(MAXKEY-210601) 企业微信扫描登录 diff --git a/gradle.properties b/gradle.properties index f004766e9..5047ef5b4 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +1,6 @@ #maxkey properties group =maxkey.top -version =2.9.0 +version =3.0.0 vendor =https://www.maxkey.top author =MaxKeyTop @@ -45,16 +45,16 @@ tomcatVersion =9.0.53 tomcatembedloggingjuliVersion =8.5.2 #spring springVersion =5.3.10 -springBootVersion =2.5.4 +springBootVersion =2.5.5 springSecurityVersion =5.5.2 springDataVersion =2.5.2 springSessionVersion =2.5.2 -springkafkaVersion =2.7.6 +springkafkaVersion =2.7.7 springretryVersion =1.3.0 springplugincoreVersion =2.0.0.RELEASE springpluginmetadataVersion =2.0.0.RELEASE springfoxVersion =3.0.0 -springcloudVersion =3.0.3 +springcloudVersion =3.0.4 springcloudalibabaVersion =2021.1 springcloudalibabaspringVersion =1.0.11 springcloudalibabacsplVersion =1.8.2 @@ -99,7 +99,7 @@ attoparserVersion =2.0.5.RELEASE unbescapeVersion =1.1.6.RELEASE jhlabsfiltersVersion =2.0.235-1 slf4jVersion =1.7.32 -jacksonVersion =2.12.4 +jacksonVersion =2.12.5 bouncycastleVersion =1.64 junitVersion =4.11 mockitoallVersion =1.10.19 @@ -108,8 +108,8 @@ nimbusjosejwtVersion =9.4.1 jcipannotationsVersion =1.0 minidevjsonsmartVersion =2.3 minidevasmVersion =1.0.2 -simplehttpVersion =1.0.3 -JustAuthVersion =1.16.3 +simplehttpVersion =1.0.5 +JustAuthVersion =1.16.4 javassistVersion =3.23.0-GA esapiVersion =2.2.0.0 javaxmailVersion =1.6.2 diff --git a/maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/autoconfigure/JwtAuthnAutoConfiguration.java b/maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/autoconfigure/JwtAuthnAutoConfiguration.java index cbfe53033..1c57e9c7f 100644 --- a/maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/autoconfigure/JwtAuthnAutoConfiguration.java +++ b/maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/autoconfigure/JwtAuthnAutoConfiguration.java @@ -108,7 +108,7 @@ public class JwtAuthnAutoConfiguration implements InitializingBean { throws NoSuchAlgorithmException, InvalidKeySpecException, JOSEException { DefaultJwtEncryptionAndDecryptionService jwtEncryptionService = new DefaultJwtEncryptionAndDecryptionService(jwtSetKeyStore); - jwtEncryptionService.setDefaultAlgorithm(JWEAlgorithm.RSA1_5);//RSA1_5 + jwtEncryptionService.setDefaultAlgorithm(JWEAlgorithm.RSA_OAEP_256);//RSA1_5 jwtEncryptionService.setDefaultDecryptionKeyId("maxkey_rsa"); jwtEncryptionService.setDefaultEncryptionKeyId("maxkey_rsa"); return jwtEncryptionService; diff --git a/maxkey-authentications/maxkey-authentication-otp/src/main/java/org/maxkey/password/onetimepwd/algorithm/HmacOTP.java b/maxkey-authentications/maxkey-authentication-otp/src/main/java/org/maxkey/password/onetimepwd/algorithm/HmacOTP.java index 472c1d76b..82527fefa 100644 --- a/maxkey-authentications/maxkey-authentication-otp/src/main/java/org/maxkey/password/onetimepwd/algorithm/HmacOTP.java +++ b/maxkey-authentications/maxkey-authentication-otp/src/main/java/org/maxkey/password/onetimepwd/algorithm/HmacOTP.java @@ -45,10 +45,10 @@ public class HmacOTP { return generateOTP(seed, count, digits); } catch (InvalidKeyException e) { e.printStackTrace(); - LoggerFactory.getLogger(HmacOTP.class).error(e.getMessage()); + logger.error(e.getMessage()); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); - LoggerFactory.getLogger(HmacOTP.class).error(e.getMessage()); + logger.error(e.getMessage()); } return ""; } diff --git a/maxkey-authentications/maxkey-authentication-otp/src/main/java/org/maxkey/password/onetimepwd/impl/SmsOtpAuthn.java b/maxkey-authentications/maxkey-authentication-otp/src/main/java/org/maxkey/password/onetimepwd/impl/SmsOtpAuthn.java index 5de472c06..dd18b829e 100644 --- a/maxkey-authentications/maxkey-authentication-otp/src/main/java/org/maxkey/password/onetimepwd/impl/SmsOtpAuthn.java +++ b/maxkey-authentications/maxkey-authentication-otp/src/main/java/org/maxkey/password/onetimepwd/impl/SmsOtpAuthn.java @@ -20,13 +20,10 @@ package org.maxkey.password.onetimepwd.impl; import java.io.IOException; import java.util.Properties; -import org.maxkey.constants.ConstantsProperties; import org.maxkey.entity.UserInfo; import org.maxkey.password.onetimepwd.AbstractOtpAuthn; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.springframework.core.io.ClassPathResource; -import org.springframework.core.io.Resource; public class SmsOtpAuthn extends AbstractOtpAuthn { private static final Logger logger = LoggerFactory.getLogger(SmsOtpAuthn.class); diff --git a/maxkey-authentications/maxkey-authentication-otp/src/test/java/org/maxkey/otp/algorithm/TimeBasedOTPTest.java b/maxkey-authentications/maxkey-authentication-otp/src/test/java/org/maxkey/otp/algorithm/TimeBasedOTPTest.java index f22db89ca..0855ebc32 100644 --- a/maxkey-authentications/maxkey-authentication-otp/src/test/java/org/maxkey/otp/algorithm/TimeBasedOTPTest.java +++ b/maxkey-authentications/maxkey-authentication-otp/src/test/java/org/maxkey/otp/algorithm/TimeBasedOTPTest.java @@ -41,7 +41,7 @@ public class TimeBasedOTPTest { byte[]byteseed= Base32Utils.decode("DCGAGPE2BCDBD6D3FG4NX2QGACVIHXP4");//HexUtils.hex2Bytes( "a1270caecf007f2303cc9db12597a9694ff541aa"); String seed=Base32Utils.encode(byteseed); - + System.out.println(seed); String hexString=Hex.encodeHexString(byteseed); //String hexString=HexUtils.bytes2HexString(byteseed); System.out.println(hexString); diff --git a/maxkey-authentications/maxkey-authentication-social/src/main/java/org/maxkey/authn/support/socialsignon/service/SocialSignOnProviderService.java b/maxkey-authentications/maxkey-authentication-social/src/main/java/org/maxkey/authn/support/socialsignon/service/SocialSignOnProviderService.java index 7b0aeb2da..f149f6752 100644 --- a/maxkey-authentications/maxkey-authentication-social/src/main/java/org/maxkey/authn/support/socialsignon/service/SocialSignOnProviderService.java +++ b/maxkey-authentications/maxkey-authentication-social/src/main/java/org/maxkey/authn/support/socialsignon/service/SocialSignOnProviderService.java @@ -59,7 +59,8 @@ public class SocialSignOnProviderService{ }else if(provider.equalsIgnoreCase("qq")) { authRequest = new AuthQqRequest(authConfig); }else if(provider.equalsIgnoreCase("Alipay")) { - authRequest = new AuthAlipayRequest(authConfig); + String alipayPublicKey = ""; + authRequest = new AuthAlipayRequest(authConfig,alipayPublicKey); }else if(provider.equalsIgnoreCase("Twitter")) { authRequest = new AuthTwitterRequest(authConfig); }else if(provider.equalsIgnoreCase("google")) { diff --git a/maxkey-common/src/main/java/org/maxkey/crypto/cert/NameUtil.java b/maxkey-common/src/main/java/org/maxkey/crypto/cert/NameUtil.java deleted file mode 100644 index 6a1efa5c2..000000000 --- a/maxkey-common/src/main/java/org/maxkey/crypto/cert/NameUtil.java +++ /dev/null @@ -1,76 +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. - */ - - -/* - * NameUtil.java - */ - -package org.maxkey.crypto.cert; - -import java.util.Vector; - -import javax.security.auth.x500.X500Principal; - -import org.bouncycastle.asn1.x509.X509Name; - -/** - * Provides utility methods relating to X50* names. - */ - -public final class NameUtil { - /** - * Private to prevent construction. - */ - private NameUtil() { - // Nothing to do - } - - /** - * Gets the common name from the given X509Name. - * - * @param name - * the X.509 name - * @return the common name, null if not found - */ - public static String getCommonName(X509Name name) { - if (name == null) { - return null; - } - - Vector values = name.getValues(X509Name.CN); - if (values == null || values.isEmpty()) { - return null; - } - - return values.get(0).toString(); - } - - /** - * Gets the common name from the given X500Principal. - * - * @param name - * the X.500 principal - * @return the common name, null if not found - */ - public static String getCommonName(X500Principal name) { - if (name == null) { - return null; - } - - return getCommonName(new X509Name(name.getName())); - } -} diff --git a/maxkey-common/src/main/java/org/maxkey/crypto/cert/StringUtil.java b/maxkey-common/src/main/java/org/maxkey/crypto/cert/StringUtil.java index ad32f44f5..6cceceda9 100644 --- a/maxkey-common/src/main/java/org/maxkey/crypto/cert/StringUtil.java +++ b/maxkey-common/src/main/java/org/maxkey/crypto/cert/StringUtil.java @@ -29,7 +29,7 @@ import java.io.InputStreamReader; import java.math.BigInteger; import java.util.Locale; -import org.bouncycastle.asn1.DERInteger; +import org.bouncycastle.asn1.ASN1Integer; /** * String utilities. @@ -64,9 +64,9 @@ public class StringUtil { bigInt = new BigInteger(1, (byte[]) obj); } - else if (obj instanceof DERInteger) + else if (obj instanceof ASN1Integer) { - bigInt = ((DERInteger) obj).getValue(); + bigInt = ((ASN1Integer) obj).getValue(); } else { diff --git a/maxkey-common/src/main/java/org/maxkey/crypto/cert/X509CertUtils.java b/maxkey-common/src/main/java/org/maxkey/crypto/cert/X509CertUtils.java index 8b8c23e52..86b6c97ff 100644 --- a/maxkey-common/src/main/java/org/maxkey/crypto/cert/X509CertUtils.java +++ b/maxkey-common/src/main/java/org/maxkey/crypto/cert/X509CertUtils.java @@ -25,18 +25,13 @@ import java.io.ByteArrayInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; -import java.io.InputStreamReader; import java.io.Reader; import java.io.StringReader; -import java.io.StringWriter; -import java.math.BigInteger; import java.net.URL; import java.security.GeneralSecurityException; import java.security.InvalidKeyException; import java.security.KeyStore; import java.security.KeyStoreException; -import java.security.PrivateKey; -import java.security.PublicKey; import java.security.Security; import java.security.SignatureException; import java.security.cert.Certificate; @@ -48,27 +43,12 @@ import java.text.MessageFormat; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; -import java.util.Date; import java.util.Enumeration; -import java.util.Hashtable; import java.util.List; -import java.util.Vector; - import javax.security.auth.x500.X500Principal; import org.apache.commons.codec.binary.Base64; -import org.bouncycastle.asn1.DERObjectIdentifier; -import org.bouncycastle.asn1.x500.X500Name; -import org.bouncycastle.asn1.x509.X509Name; -import org.bouncycastle.cert.X509v3CertificateBuilder; -import org.bouncycastle.cert.jcajce.JcaX509v3CertificateBuilder; -import org.bouncycastle.jce.PKCS10CertificationRequest; -import org.bouncycastle.jce.PrincipalUtil; -import org.bouncycastle.jce.X509Principal; import org.bouncycastle.openssl.PEMParser; -import org.bouncycastle.openssl.PEMWriter; -import org.bouncycastle.openssl.PasswordException; -import org.bouncycastle.x509.X509V3CertificateGenerator; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -82,16 +62,16 @@ public final class X509CertUtils { // Logger.getLogger(X509CertUtil.class.getCanonicalName()); private static final Logger _logger = LoggerFactory.getLogger(X509CertUtils.class); /** PKCS #7 encoding name */ - private static final String PKCS7_ENCODING = "PKCS7"; + public static final String PKCS7_ENCODING = "PKCS7"; /** PkiPath encoding name */ - private static final String PKIPATH_ENCODING = "PkiPath"; + public static final String PKIPATH_ENCODING = "PkiPath"; /** OpenSSL PEM encoding name */ - private static final String OPENSSL_PEM_ENCODING = "OpenSSL_PEM"; + public static final String OPENSSL_PEM_ENCODING = "OpenSSL_PEM"; /** Type name for X.509 certificates */ - private static final String X509_CERT_TYPE = "X.509"; + public static final String X509_CERT_TYPE = "X.509"; /** * Private to prevent construction. @@ -100,40 +80,7 @@ public final class X509CertUtils { // Nothing to do } - /** - * Load one or more certificates from the specified URL, trying a built in - * list of certification encodings. - * - * @param url - * The URL to load certificates from - * @param exceptions - * Collection where exceptions occurred will be added - * @return The certificates - * @throws IOException - * if an error accessing the URL occurs - */ - public static X509Certificate[] loadCertificates(URL url, - Collection exceptions) throws IOException { - URL downloadedUrl = NetUtil.download(url); - X509Certificate[] certs = null; - for (String certType : new String[] { PKCS7_ENCODING, PKIPATH_ENCODING, - null, OPENSSL_PEM_ENCODING }) { - try { - certs = loadCertificates(downloadedUrl, certType); - break; // Success! - } catch (FileNotFoundException e) { - // Don't bother with rest of the types, just show the exception - // once - exceptions.add(e); - break; - } catch (Exception e) { - exceptions.add(e); - } - } - - return certs; - } public static X509Certificate loadCertFromPEM(String strPEM) { StringReader stringReader = new StringReader(strPEM); @@ -179,109 +126,7 @@ public final class X509CertUtils { } } - /** - * Load one or more certificates from the specified URL. - * - * @param url - * The URL to load certificates from - * @param encoding - * The certification path encoding. If null, treat as a normal - * certificate, not certification path. Use one of the - * *_ENCODING constants here. - * @return The certificates - * @throws CryptoException - * Problem encountered while loading the certificate(s) - * @throws FileNotFoundException - * If the certificate file does not exist, is a directory rather - * than a regular file, or for some other reason cannot be - * opened for reading - * @throws IOException - * An I/O error occurred - */ - private static X509Certificate[] loadCertificates(URL url, String encoding) - throws CryptoException, IOException { - // TODO: connect/read timeouts - - InputStream in = NetUtil.openGetStream(url); - Collection certs; - - try { - if (OPENSSL_PEM_ENCODING.equals(encoding)) { - // Special case; this is not a real JCE supported encoding. - // Note: let PEMReader use its default provider (BC as of BC - // 1.40) internally; for example the - // default "SUN" provider may not contain an RSA implementation - PEMParser pr = new PEMParser(new InputStreamReader(in)); - - // These beasts can contain just about anything, and - // unfortunately the PEMReader API (as of BC - // 1.25 to at least 1.43) won't allow us to really skip things - // we're not interested in; stuff - // happens already in readObject(). - - certs = new ArrayList(); - Object cert; - - while (true) { - try { - cert = pr.readObject(); - } catch (IOException e) { - if (e instanceof PasswordException) { - // Some kind of a password protected item (BC >= - // 1.44): carry on, see - // http://www.bouncycastle.org/jira/browse/BJA-182 - continue; - } - throw e; - } - - if (cert == null) { - break; - } - - if (cert instanceof X509Certificate) { - certs.add(cert); - } - // Skip other stuff, at least for now. - } - - pr.close(); - } else { - CertificateFactory cf = CertificateFactory - .getInstance(X509_CERT_TYPE); - - if (encoding != null) { - // Try it as a certification path of the specified type - certs = cf.generateCertPath(in, encoding).getCertificates(); - } else { - // "Normal" certificate(s) - certs = cf.generateCertificates(in); - } - - // Note that we rely on cf.generateCert() above to never return - // null nor a collection - // containing nulls. - } - } - // Some RuntimeExceptions which really should be CertificateExceptions - // may be thrown from - // cf.generateCert* above, for example Oracle's PKCS #7 parser tends to - // throw them... :P - catch (Exception ex) { - // TODO: don't throw if vCerts non-empty (eg. OpenSSL PEM above)? - throw new CryptoException("Could not load certificate.", ex); - } finally { - try { - in.close(); - } catch (IOException e) { - _logger.warn("Could not close input stream from " + url, e); - // LOG.log(Level.WARNING, "Could not close input stream from " + - // url, e); - } - } - - return (X509Certificate[]) certs.toArray(new X509Certificate[certs.size()]); - } + /** * Load a CRL from the specified URL. @@ -318,50 +163,7 @@ public final class X509CertUtils { } } - /** - * Load a CSR from the specified URL. - * - * @param url - * The URL to load CSR from - * @return The CSR - * @throws CryptoException - * Problem encountered while loading the CSR - * @throws FileNotFoundException - * If the CSR file does not exist, is a directory rather than a - * regular file, or for some other reason cannot be opened for - * reading - * @throws IOException - * An I/O error occurred - */ - public static PKCS10CertificationRequest loadCSR(URL url) - throws CryptoException, IOException { - // TODO: handle DER encoded requests too? - PEMParser pr = new PEMParser(new InputStreamReader( - NetUtil.openGetStream(url))); - try { - PKCS10CertificationRequest csr = (PKCS10CertificationRequest) pr - .readObject(); - if (!csr.verify()) { - throw new CryptoException( - "Could not verify certification request."); - } - return csr; - } catch (ClassCastException ex) { - throw new CryptoException("Could not load certification request.", - ex); - } catch (GeneralSecurityException ex) { - throw new CryptoException("Could not load certification request.", - ex); - } finally { - try { - pr.close(); - } catch (IOException e) { - _logger.warn("Could not close input stream from " + url, e); - // LOG.log(Level.WARNING, "Could not close input stream from " + - // url, e); - } - } - } + /** * Convert the supplied array of certificate objects into X509Certificate @@ -574,248 +376,7 @@ public final class X509CertUtils { } } - /** - * Generate a self-signed X509 Version 1 certificate for the supplied key - * pair and signature algorithm. - * - * @return The generated certificate - * @param sCommonName - * Common name certificate attribute - * @param sOrganisationUnit - * Organization Unit certificate attribute - * @param sOrganisation - * Organization certificate attribute - * @param sLocality - * Locality certificate - * @param sState - * State certificate attribute - * @param sEmailAddress - * Email Address certificate attribute - * @param sCountryCode - * Country Code certificate attribute - * @param iValidity - * Validity period of certificate in days - * @param publicKey - * Public part of key pair - * @param privateKey - * Private part of key pair - * @param signatureType - * Signature Type - * @throws CryptoException - * If there was a problem generating the certificate - */ - public static X509Certificate generateCert(String sCommonName, - String sOrganisationUnit, String sOrganisation, String sLocality, - String sState, String sCountryCode, String sEmailAddress, - int iValidity, PublicKey publicKey, PrivateKey privateKey, - SignatureType signatureType) throws CryptoException { - // Holds certificate attributes - - - Hashtable attrs = new Hashtable(); - Vector vOrder = new Vector(); - - // Load certificate attributes - /* - if (sCommonName != null) { - attrs.put(X509Name.CN, sCommonName); - vOrder.add(0, X509Name.CN); - } - - if (sOrganisationUnit != null) { - attrs.put(X509Name.OU, sOrganisationUnit); - vOrder.add(0, X509Name.OU); - } - - if (sOrganisation != null) { - attrs.put(X509Name.O, sOrganisation); - vOrder.add(0, X509Name.O); - } - - if (sLocality != null) { - attrs.put(X509Name.L, sLocality); - vOrder.add(0, X509Name.L); - } - - if (sState != null) { - attrs.put(X509Name.ST, sState); - vOrder.add(0, X509Name.ST); - } - - if (sCountryCode != null) { - attrs.put(X509Name.C, sCountryCode); - vOrder.add(0, X509Name.C); - } - - if (sEmailAddress != null) { - attrs.put(X509Name.E, sEmailAddress); - vOrder.add(0, X509Name.E); - }*/ - - // Get an X509 Version 1 Certificate generator - X509V3CertificateGenerator certGen = new X509V3CertificateGenerator(); - - // Load the generator with generation parameters - - // Set the issuer distinguished name - certGen.setIssuerDN(new X509Principal(vOrder, attrs)); - - // Valid before and after dates now to iValidity days in the future - certGen.setNotBefore(new Date(System.currentTimeMillis())); - certGen.setNotAfter(new Date(System.currentTimeMillis() - + ((long) iValidity * 24 * 60 * 60 * 1000))); - - // Set the subject distinguished name (same as issuer for our purposes) - certGen.setSubjectDN(new X509Principal(vOrder, attrs)); - - // Set the public key - certGen.setPublicKey(publicKey); - - // Set the algorithm - certGen.setSignatureAlgorithm(signatureType.name()); - - // Set the serial number - certGen.setSerialNumber(generateX509SerialNumber()); - - X509v3CertificateBuilder builder = new JcaX509v3CertificateBuilder( - new X500Name("issueDn"), - generateX509SerialNumber(), - new Date(System.currentTimeMillis()), - new Date(System.currentTimeMillis()+ ((long) iValidity * 24 * 60 * 60 * 1000)), - new X500Name("subjectDn"), - publicKey); - - try { - // Generate an X.509 certificate, based on the current issuer and - // subject - return certGen.generate(privateKey, "BC"); - } - // Something went wrong - catch (GeneralSecurityException ex) { - throw new CryptoException("Certificate generation failed.", ex); - } - } - - /** - * Renew a self-signed X509 Version 1 certificate. - * - * @return The renewed certificate - * @param oldCert - * old certificate - * @param iValidity - * Validity period of certificate in days to add to the old - * cert's expiry date, or current time if the certificate has - * expired - * @param publicKey - * Public part of key pair - * @param privateKey - * Private part of key pair - * @throws CryptoException - * If there was a problem generating the certificate - */ - public static X509Certificate renewCert(X509Certificate oldCert, - int iValidity, PublicKey publicKey, PrivateKey privateKey) - throws CryptoException { - // Get an X509 Version 1 Certificate generator - X509V3CertificateGenerator certGen = new X509V3CertificateGenerator(); - - // Load the generator with generation parameters - - // Valid before and after dates now to iValidity days in the future from - // now or existing expiry date - Date now = new Date(); - Date oldExpiry = oldCert.getNotAfter(); - if (oldExpiry == null || oldExpiry.before(now)) { - oldExpiry = now; - } - - certGen.setNotBefore(now); - certGen.setNotAfter(new Date(oldExpiry.getTime() - + ((long) iValidity * 24 * 60 * 60 * 1000))); - - // Set the public key - certGen.setPublicKey(publicKey); - - // Set the algorithm - certGen.setSignatureAlgorithm(oldCert.getSigAlgName()); - - // Set the serial number - certGen.setSerialNumber(generateX509SerialNumber()); - - try { - // Set the issuer distinguished name - // TODO: verify/force self-signedness - certGen.setIssuerDN(PrincipalUtil.getIssuerX509Principal(oldCert)); - - // Set the subject distinguished name (same as issuer for our - // purposes) - certGen.setSubjectDN(PrincipalUtil.getSubjectX509Principal(oldCert)); - - // Generate an X.509 certificate, based on the current issuer and - // subject - return certGen.generate(privateKey, "BC"); - } - // Something went wrong - catch (GeneralSecurityException ex) { - throw new CryptoException("Certificate generation failed.", ex); - } - } - - /** - * Generate a unique serial number for use as an X509 serial number. - * - * @return The unique serial number - */ - private static BigInteger generateX509SerialNumber() { - // Time in seconds - return new BigInteger(Long.toString(System.currentTimeMillis() / 1000)); - } - - public static String generatePEMEncoded(Certificate cert) { - StringWriter encoded = new StringWriter(); - PEMWriter pEMWriter = new PEMWriter(encoded); - try { - pEMWriter.writeObject(cert); - pEMWriter.close(); - return encoded.toString(); - } catch (IOException e) { - e.printStackTrace(); - } - return null; - } - - /** - * Create a PKCS #10 certification request (CSR) using the supplied - * certificate and private key. - * - * @param cert - * The certificate - * @param privateKey - * The private key - * @throws CryptoException - * If there was a problem generating the CSR - * @return The CSR - */ - public static PKCS10CertificationRequest generatePKCS10CSR( - X509Certificate cert, PrivateKey privateKey) throws CryptoException { - X509Name subject = new X509Name(cert.getSubjectDN().toString()); - - try { - PKCS10CertificationRequest csr = new PKCS10CertificationRequest( - cert.getSigAlgName(), subject, cert.getPublicKey(), null, - privateKey); - if (!csr.verify()) { - throw new CryptoException( - "Could not verify generated certification request."); - } - - return csr; - } catch (GeneralSecurityException ex) { - throw new CryptoException( - "Could not generate a certification request.", ex); - } - } /** * Verify that one X.509 certificate was signed using the private key that @@ -1008,22 +569,42 @@ public final class X509CertUtils { X500Principal subject = cert.getSubjectX500Principal(); X500Principal issuer = cert.getIssuerX500Principal(); - String sSubjectCN = NameUtil.getCommonName(subject); + String sSubjectCN = getCommonName(subject); // Could not get a subject CN - return blank if (sSubjectCN == null) { return ""; } - String sIssuerCN = NameUtil.getCommonName(issuer); + String sIssuerCN = getCommonName(issuer); // Self-signed certificate or could not get an issuer CN if (subject.equals(issuer) || sIssuerCN == null) { // Alias is the subject CN return sSubjectCN; } + _logger.debug("{0} ({1})", sSubjectCN, sIssuerCN); // else non-self-signed certificate // Alias is the subject CN followed by the issuer CN in parenthesis return MessageFormat.format("{0} ({1})", sSubjectCN, sIssuerCN); } + + + public static String getCommonName(X500Principal name) { + if (name == null) { + return null; + } + String value = name.getName(); + + if(value.indexOf(",") > -1) { + value = value.split(",")[0]; + } + + if(value.indexOf("=")>-1) { + value = value.split("=")[1]; + } + + return value; + } + } diff --git a/maxkey-common/src/main/java/org/maxkey/crypto/cert/X509V3CertGen.java b/maxkey-common/src/main/java/org/maxkey/crypto/cert/X509V3CertGen.java index 18d446a4c..d9dfc5be3 100644 --- a/maxkey-common/src/main/java/org/maxkey/crypto/cert/X509V3CertGen.java +++ b/maxkey-common/src/main/java/org/maxkey/crypto/cert/X509V3CertGen.java @@ -61,12 +61,16 @@ public final class X509V3CertGen { PrivateKey privateKey=keyPair.getPrivate(); SubjectPublicKeyInfo subjectPublicKeyInfo = null; + ASN1InputStream publicKeyInputStream =null; try { - Object aiStream=new ASN1InputStream(publicKey.getEncoded()).readObject(); + publicKeyInputStream =new ASN1InputStream(publicKey.getEncoded()); + Object aiStream=publicKeyInputStream.readObject(); subjectPublicKeyInfo = SubjectPublicKeyInfo.getInstance(aiStream); } catch (IOException e1) { e1.printStackTrace(); - } + } finally { + if(publicKeyInputStream !=null)publicKeyInputStream.close(); + } X509v3CertificateBuilder certBuilder = new X509v3CertificateBuilder(x500Name, diff --git a/maxkey-common/src/main/java/org/maxkey/crypto/jwt/encryption/service/impl/RecipientJwtEncryptionAndDecryptionServiceBuilder.java b/maxkey-common/src/main/java/org/maxkey/crypto/jwt/encryption/service/impl/RecipientJwtEncryptionAndDecryptionServiceBuilder.java index 8f3cb789b..4fde14806 100644 --- a/maxkey-common/src/main/java/org/maxkey/crypto/jwt/encryption/service/impl/RecipientJwtEncryptionAndDecryptionServiceBuilder.java +++ b/maxkey-common/src/main/java/org/maxkey/crypto/jwt/encryption/service/impl/RecipientJwtEncryptionAndDecryptionServiceBuilder.java @@ -23,14 +23,9 @@ package org.maxkey.crypto.jwt.encryption.service.impl; import java.security.NoSuchAlgorithmException; import java.security.spec.InvalidKeySpecException; import java.text.ParseException; -import org.apache.http.client.HttpClient; -import org.apache.http.impl.client.HttpClientBuilder; import org.apache.log4j.Logger; import org.maxkey.crypto.jose.keystore.JWKSetKeyStore; import org.maxkey.crypto.jwt.encryption.service.JwtEncryptionAndDecryptionService; -import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; -import org.springframework.web.client.RestTemplate; - import com.nimbusds.jose.JOSEException; import com.nimbusds.jose.jwk.JWKSet; diff --git a/maxkey-common/src/main/java/org/maxkey/crypto/jwt/signer/service/impl/SymmetricCacheService.java b/maxkey-common/src/main/java/org/maxkey/crypto/jwt/signer/service/impl/SymmetricCacheService.java index f88b7d134..3f02ca658 100644 --- a/maxkey-common/src/main/java/org/maxkey/crypto/jwt/signer/service/impl/SymmetricCacheService.java +++ b/maxkey-common/src/main/java/org/maxkey/crypto/jwt/signer/service/impl/SymmetricCacheService.java @@ -34,9 +34,6 @@ import com.google.common.cache.LoadingCache; import com.google.common.collect.ImmutableMap; import com.google.common.util.concurrent.UncheckedExecutionException; import com.nimbusds.jose.jwk.JWK; -import com.nimbusds.jose.jwk.KeyUse; -import com.nimbusds.jose.jwk.OctetSequenceKey; -import com.nimbusds.jose.util.Base64URL; /** * Creates and caches symmetrical validators for clients based on client secrets. diff --git a/maxkey-common/src/main/java/org/maxkey/crypto/jwt/signer/service/impl/SymmetricSigningAndValidationServiceBuilder.java b/maxkey-common/src/main/java/org/maxkey/crypto/jwt/signer/service/impl/SymmetricSigningAndValidationServiceBuilder.java index 5308166a5..db6e38d0c 100644 --- a/maxkey-common/src/main/java/org/maxkey/crypto/jwt/signer/service/impl/SymmetricSigningAndValidationServiceBuilder.java +++ b/maxkey-common/src/main/java/org/maxkey/crypto/jwt/signer/service/impl/SymmetricSigningAndValidationServiceBuilder.java @@ -30,9 +30,6 @@ import org.maxkey.crypto.jwt.signer.service.JwtSigningAndValidationService; import com.google.common.collect.ImmutableMap; import com.nimbusds.jose.JOSEException; import com.nimbusds.jose.jwk.JWK; -import com.nimbusds.jose.jwk.KeyUse; -import com.nimbusds.jose.jwk.OctetSequenceKey; -import com.nimbusds.jose.util.Base64URL; /** * @author Crystal.Sea diff --git a/maxkey-common/src/main/java/org/maxkey/crypto/keystore/KeyStoreLoader.java b/maxkey-common/src/main/java/org/maxkey/crypto/keystore/KeyStoreLoader.java index 237406f13..b6757d7cd 100644 --- a/maxkey-common/src/main/java/org/maxkey/crypto/keystore/KeyStoreLoader.java +++ b/maxkey-common/src/main/java/org/maxkey/crypto/keystore/KeyStoreLoader.java @@ -26,9 +26,7 @@ import java.util.Enumeration; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.InitializingBean; -import org.springframework.core.io.ClassPathResource; import org.springframework.core.io.Resource; -import org.springframework.util.ResourceUtils; /** * . diff --git a/maxkey-common/src/main/java/org/maxkey/crypto/keystore/KeyStoreUtil.java b/maxkey-common/src/main/java/org/maxkey/crypto/keystore/KeyStoreUtil.java index ad3cb15b4..178552fc9 100644 --- a/maxkey-common/src/main/java/org/maxkey/crypto/keystore/KeyStoreUtil.java +++ b/maxkey-common/src/main/java/org/maxkey/crypto/keystore/KeyStoreUtil.java @@ -56,6 +56,8 @@ import org.maxkey.crypto.Base64Utils; import org.maxkey.crypto.cert.CryptoException; import org.maxkey.crypto.cert.X509CertUtils; import org.maxkey.crypto.cert.X509V3CertGen; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.core.io.Resource; /** @@ -64,7 +66,8 @@ import org.springframework.core.io.Resource; * UBER type keystores. */ public final class KeyStoreUtil { - + private static final Logger _logger = LoggerFactory.getLogger(KeyStoreUtil.class); + public static final String X509 = "X.509"; /** Map of available keystore types */ @@ -536,15 +539,15 @@ public final class KeyStoreUtil { try { sMatchAlias = X509CertUtils.matchCertificate(keyStore, trustCert); - System.out.println("sMatchAlias : " + sMatchAlias); + _logger.debug("sMatchAlias : " + sMatchAlias); if (sMatchAlias != null) { - System.out.println("The certificate already exists in the Keystore under alias ''" + sMatchAlias + _logger.debug("\nThe certificate already exists in the Keystore under alias ''" + sMatchAlias + "''.\nDo you still want to import it?"); } else { KeyStore[] keyStores = { keyStore }; if (X509CertUtils.establishTrust(keyStores, trustCert) == null) { - System.out.println( - "Could not establish a trust path for the certficate.\nThe certficate information will now be displayed after\nwhich you may confirm whether or not you trust the\ncertificate."); + _logger.debug( + "\nCould not establish a trust path for the certficate.\nThe certficate information will now be displayed after\nwhich you may confirm whether or not you trust the certificate."); } // Delete old entry first diff --git a/maxkey-common/src/main/java/org/maxkey/util/BeanConvert.java b/maxkey-common/src/main/java/org/maxkey/util/BeanConvert.java index 1e579810c..658dbf1d6 100644 --- a/maxkey-common/src/main/java/org/maxkey/util/BeanConvert.java +++ b/maxkey-common/src/main/java/org/maxkey/util/BeanConvert.java @@ -58,6 +58,8 @@ public class BeanConvert { LogFactory.getLog(BeanConvert.class).debug("bean2Map() *******************************************"); return mapBean; } + + public static Object map2Bean(T bean,HashMap valueMap){ Map beanFiledMap=null; try { @@ -71,6 +73,7 @@ public class BeanConvert { LogFactory.getLog(BeanConvert.class).debug("map2Bean() "+bean.getClass().getName()); int i=1; while (fieldit.hasNext()) { + @SuppressWarnings("rawtypes") Map.Entry entry = (Map.Entry) fieldit.next(); String fieldName = entry.getKey().toString(); Object value = null; diff --git a/maxkey-common/src/main/java/org/maxkey/util/BeanUtil.java b/maxkey-common/src/main/java/org/maxkey/util/BeanUtil.java index 7f3a7c5c5..d73fbb3ec 100644 --- a/maxkey-common/src/main/java/org/maxkey/util/BeanUtil.java +++ b/maxkey-common/src/main/java/org/maxkey/util/BeanUtil.java @@ -167,7 +167,8 @@ public class BeanUtil { return Instance.newInstance(className, args); } - public static T newInstance(Class cls, Object[] args) { + @SuppressWarnings("unchecked") + public static T newInstance(Class cls, Object[] args) { return (T) Instance.newInstance(cls, args); } public static Object invokeMethod(Object bean, String methodName, Object[] args) @@ -201,7 +202,7 @@ public class BeanUtil { Map map = new HashMap(); for (int i = 0; i < flds.length; i++) { String name = flds[i].getName(); - map.put(flds[i].getName(), flds[i].getType().getName()); + map.put(name, flds[i].getType().getName()); } return map; } @@ -311,10 +312,10 @@ public class BeanUtil { } } - public static Class[] getMethodParameterTypes(Class c,String methodName){ + public static Class[] getMethodParameterTypes(Class c,String methodName){ Method []methods=c.getMethods(); for (Method method : methods) { - Class[] parameterTypes = method.getParameterTypes(); + Class[] parameterTypes = method.getParameterTypes(); if(method.getName().equals(methodName)){ return parameterTypes; } diff --git a/maxkey-common/src/main/java/org/maxkey/util/DynaBean.java b/maxkey-common/src/main/java/org/maxkey/util/DynaBean.java index d90e2d58c..e412a59d1 100644 --- a/maxkey-common/src/main/java/org/maxkey/util/DynaBean.java +++ b/maxkey-common/src/main/java/org/maxkey/util/DynaBean.java @@ -59,7 +59,8 @@ public class DynaBean { beanMap.remove(name); } - public void displayValues(){ + @SuppressWarnings("rawtypes") + public void displayValues(){ Iterator beanMapit = beanMap.entrySet().iterator(); int i=1; LogFactory.getLog(DynaBean.class).debug("displayValues() *******************************************"); @@ -84,7 +85,8 @@ public class DynaBean { return beanMap; } - public DynaBean mapToDynaBean(Map map){ + @SuppressWarnings("rawtypes") + public DynaBean mapToDynaBean(Map map){ if(map.getClass().getName()=="java.util.HashMap"){ beanMap=(HashMap)map; diff --git a/maxkey-common/src/main/java/org/maxkey/util/Instance.java b/maxkey-common/src/main/java/org/maxkey/util/Instance.java index ec2d6ed5b..10dc650f7 100644 --- a/maxkey-common/src/main/java/org/maxkey/util/Instance.java +++ b/maxkey-common/src/main/java/org/maxkey/util/Instance.java @@ -62,7 +62,7 @@ public class Instance { Class newClass; try { newClass = Class.forName(className); - Class[] argsClass = new Class[args.length]; + Class[] argsClass = new Class[args.length]; for (int i = 0, j = args.length; i < j; i++) { argsClass[i] = args[i].getClass(); @@ -79,7 +79,7 @@ public class Instance { public static Object newInstance(Class cls, Object[] args) { try { - Class[] argsClass = new Class[args.length]; + Class[] argsClass = new Class[args.length]; for (int i = 0, j = args.length; i < j; i++) { argsClass[i] = args[i].getClass(); diff --git a/maxkey-common/src/main/java/org/maxkey/util/MethodInvoke.java b/maxkey-common/src/main/java/org/maxkey/util/MethodInvoke.java index 0572d8c15..4f80ec3aa 100644 --- a/maxkey-common/src/main/java/org/maxkey/util/MethodInvoke.java +++ b/maxkey-common/src/main/java/org/maxkey/util/MethodInvoke.java @@ -38,7 +38,7 @@ public class MethodInvoke { public static Object invokeMethod(Object bean, String methodName, Object[] args) throws Exception { Class beanClass = bean.getClass(); - Class[] argsClass = new Class[args.length]; + Class[] argsClass = new Class[args.length]; for (int i = 0, j = args.length; i < j; i++) { argsClass[i] = args[i].getClass(); //LogFactory.getLog(MethodInvoke.class).debug("invokeMethod args : "+args[i]+" argsClass:"+argsClass[i]); @@ -59,7 +59,7 @@ public class MethodInvoke { public static Object invokeStaticMethod(Class beanClass, String methodName, Object[] args) throws Exception { - Class[] argsClass = new Class[args.length]; + Class[] argsClass = new Class[args.length]; for (int i = 0, j = args.length; i < j; i++) { argsClass[i] = args[i].getClass(); //LogFactory.getLog(MethodInvoke.class).debug("invokeStaticMethod args : "+args[i]+" argsClass:"+argsClass[i]); diff --git a/maxkey-common/src/test/java/org/maxkey/Copyright4RZ.java b/maxkey-common/src/test/java/org/maxkey/Copyright4RZ.java new file mode 100644 index 000000000..79a19e0fb --- /dev/null +++ b/maxkey-common/src/test/java/org/maxkey/Copyright4RZ.java @@ -0,0 +1,193 @@ +/* + * 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; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.OutputStreamWriter; +import java.io.UnsupportedEncodingException; + +/** + * 给java文件批量添加License信息. + * @author MaxKey Copyright Adder + * + */ +public class Copyright4RZ { + // 存放java文件的文件夹,必须是文件夹 + private static String srcFolder = "D:\\MaxKey\\Workspaces\\maxkey\\MaxKey\\maxkey-webs\\maxkey-web-mgt"; + + //已添加标识 + private static String copyRightText = "http://www.apache.org/licenses/LICENSE-2.0"; + //扫描目录 + private String folder; + //待添加所以文件统计 + private long fileCount = 0; + //添加的问题就统计 + private long copyRightFileCount = 0; + private static String lineSeperator = System.getProperty("line.separator"); + private static String encode = "UTF-8"; + private static OutputStreamWriter writer; + + static { + try { + writer = new OutputStreamWriter(new FileOutputStream("D:/MaxKey/code.txt"), encode); + } catch (UnsupportedEncodingException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (FileNotFoundException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + /** + * Copyright. + * @param folder java文件夹. + * @param copyRight 版权内容. + */ + public Copyright4RZ(String folder, String copyRight) { + this.folder = folder; + } + + /** + * main . + * @param args String + * @throws IOException IOException + */ + public static void main(String[] args) throws IOException { + // 从文件读取版权内容 + // 在D盘创建一个copyright.txt文件,把版权内容放进去即可 + String copyright = readCopyrightFromFile( + Copyright4RZ.class.getResource("copyright.txt").getFile()); + new Copyright4RZ(srcFolder, copyright).process(); + + writer.close(); + } + + /** + * process. + * @throws IOException not + */ + public void process() throws IOException { + this.addCopyright(new File(folder)); + System.out.println("fileCount " + fileCount); + System.out.println("copyRightFileCount " + copyRightFileCount); + } + + private void addCopyright(File folder) throws IOException { + File[] files = folder.listFiles(); + + if (files == null || files.length == 0) { + return; + } + + for (File f : files) { + if (f.isFile()) { + doAddCopyright(f); + } else { + addCopyright(f); + } + } + } + + private void doAddCopyright(File file) throws IOException { + String fileName = file.getName(); + boolean isJavaFile = fileName.toLowerCase().endsWith(".java"); + //boolean isJavaFile = fileName.toLowerCase().endsWith(".ftl"); + this.fileCount++; + if (isJavaFile) { + copyRightFileCount++; + System.out.println(file.getAbsolutePath()); + try { + this.doWrite(file); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + + private void doWrite(File file) throws IOException { + StringBuilder javaFileContent = new StringBuilder(); + String line = null; + boolean isAddCopyrightFile = isAddCopyrightFile(file.getAbsolutePath()); + // 先添加copyright到文件头 + //javaFileContent.append(copyRight).append(lineSeperator); + // 追加剩余内容 + BufferedReader br = new BufferedReader( + new InputStreamReader(new FileInputStream(file), encode)); + + int i=0; + while ((line = br.readLine()) != null) { + if(isAddCopyrightFile && i< 16) { + i++; + continue; + } + if(line.equals("") + ||line.replaceAll(" ", "").equals("") + ||line.replaceAll("\t", "").equals("") + ) { + + }else { + javaFileContent.append(line).append(lineSeperator); + } + } + + //OutputStreamWriter writer = new OutputStreamWriter(new FileOutputStream(file), encode); + writer.write(javaFileContent.toString()); + + br.close(); + } + + private static String readCopyrightFromFile(String copyFilePath) throws IOException { + StringBuilder copyright = new StringBuilder(); + + String line = null; + + BufferedReader br = new BufferedReader( + new InputStreamReader(new FileInputStream(copyFilePath), encode)); + + while ((line = br.readLine()) != null) { + copyright.append(line).append(lineSeperator); + } + br.close(); + + return copyright.toString(); + } + + private static boolean isAddCopyrightFile(String filePath) throws IOException { + boolean isAddCopyright = false; + String line = null; + + BufferedReader br = new BufferedReader( + new InputStreamReader(new FileInputStream(filePath), encode)); + + while ((line = br.readLine()) != null) { + if (line.indexOf(copyRightText) > -1) { + isAddCopyright = true; + break; + } + } + br.close(); + + return isAddCopyright; + } + +} \ No newline at end of file diff --git a/maxkey-common/src/test/java/org/maxkey/cache/CacheFactoryTest.java b/maxkey-common/src/test/java/org/maxkey/cache/CacheFactoryTest.java index ba6c3d917..0ce99e0c3 100644 --- a/maxkey-common/src/test/java/org/maxkey/cache/CacheFactoryTest.java +++ b/maxkey-common/src/test/java/org/maxkey/cache/CacheFactoryTest.java @@ -22,11 +22,8 @@ package org.maxkey.cache; import java.util.ArrayList; -import org.maxkey.cache.AbstractCache; -import org.maxkey.cache.CacheFactory; - /** - * @author amarsoft + * @author Crystal.sea * */ public class CacheFactoryTest { diff --git a/maxkey-common/src/test/java/org/maxkey/cache/RandomCache.java b/maxkey-common/src/test/java/org/maxkey/cache/RandomCache.java index 5077d11ef..aa635fd3c 100644 --- a/maxkey-common/src/test/java/org/maxkey/cache/RandomCache.java +++ b/maxkey-common/src/test/java/org/maxkey/cache/RandomCache.java @@ -22,8 +22,6 @@ package org.maxkey.cache; import java.util.Random; -import org.maxkey.cache.AbstractCache; - /** * @author amarsoft * diff --git a/maxkey-common/src/test/java/org/maxkey/crypto/Base64UtilsTest.java b/maxkey-common/src/test/java/org/maxkey/crypto/Base64UtilsTest.java index 95e7daeec..acb42145e 100644 --- a/maxkey-common/src/test/java/org/maxkey/crypto/Base64UtilsTest.java +++ b/maxkey-common/src/test/java/org/maxkey/crypto/Base64UtilsTest.java @@ -18,7 +18,6 @@ package org.maxkey.crypto; import org.junit.Test; -import org.maxkey.crypto.Base64Utils; public class Base64UtilsTest { diff --git a/maxkey-common/src/test/java/org/maxkey/crypto/DigestUtilsTest.java b/maxkey-common/src/test/java/org/maxkey/crypto/DigestUtilsTest.java index 4b6d71875..3802a1500 100644 --- a/maxkey-common/src/test/java/org/maxkey/crypto/DigestUtilsTest.java +++ b/maxkey-common/src/test/java/org/maxkey/crypto/DigestUtilsTest.java @@ -18,10 +18,7 @@ package org.maxkey.crypto; import java.time.Instant; -import java.util.Date; - import org.junit.Test; -import org.maxkey.crypto.DigestUtils; public class DigestUtilsTest { /* diff --git a/maxkey-common/src/test/java/org/maxkey/crypto/Md5SumTest.java b/maxkey-common/src/test/java/org/maxkey/crypto/Md5SumTest.java index b3a555a17..c40958492 100644 --- a/maxkey-common/src/test/java/org/maxkey/crypto/Md5SumTest.java +++ b/maxkey-common/src/test/java/org/maxkey/crypto/Md5SumTest.java @@ -20,8 +20,6 @@ package org.maxkey.crypto; import java.io.File; import java.io.FileNotFoundException; -import org.maxkey.crypto.Md5Sum; - public class Md5SumTest { public Md5SumTest() { diff --git a/maxkey-common/src/test/java/org/maxkey/crypto/RSAUtilsTest.java b/maxkey-common/src/test/java/org/maxkey/crypto/RSAUtilsTest.java index cd44025cd..39e869757 100644 --- a/maxkey-common/src/test/java/org/maxkey/crypto/RSAUtilsTest.java +++ b/maxkey-common/src/test/java/org/maxkey/crypto/RSAUtilsTest.java @@ -21,13 +21,11 @@ import java.security.Key; import java.util.Map; import org.junit.Test; -import org.maxkey.crypto.Base64Utils; -import org.maxkey.crypto.HexUtils; -import org.maxkey.crypto.RSAUtils; + public class RSAUtilsTest { - //@Test + @Test public void test() throws Exception { // ˽Կ���ܡ�����Կ���� diff --git a/maxkey-common/src/test/java/org/maxkey/crypto/ReciprocalUtilsTest.java b/maxkey-common/src/test/java/org/maxkey/crypto/ReciprocalUtilsTest.java index 087c663b9..a473bd533 100644 --- a/maxkey-common/src/test/java/org/maxkey/crypto/ReciprocalUtilsTest.java +++ b/maxkey-common/src/test/java/org/maxkey/crypto/ReciprocalUtilsTest.java @@ -20,7 +20,6 @@ package org.maxkey.crypto; import java.io.UnsupportedEncodingException; import org.junit.Test; -import org.maxkey.crypto.ReciprocalUtils; public class ReciprocalUtilsTest { @Test diff --git a/maxkey-common/src/test/java/org/maxkey/crypto/cert/X509V3CertGenTest.java b/maxkey-common/src/test/java/org/maxkey/crypto/cert/X509V3CertGenTest.java index 3e0507265..6d11e80f5 100644 --- a/maxkey-common/src/test/java/org/maxkey/crypto/cert/X509V3CertGenTest.java +++ b/maxkey-common/src/test/java/org/maxkey/crypto/cert/X509V3CertGenTest.java @@ -26,11 +26,10 @@ import java.util.Date; import org.joda.time.DateTime; import org.junit.Test; -import org.maxkey.crypto.cert.X509V3CertGen; public class X509V3CertGenTest { - //@Test + @Test public void generateV3() throws Exception { Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider()); KeyPair keyPair =X509V3CertGen.genRSAKeyPair(); diff --git a/maxkey-common/src/test/java/org/maxkey/crypto/signature/DsaSignerTest.java b/maxkey-common/src/test/java/org/maxkey/crypto/signature/DsaSignerTest.java index b38ce1985..3e60794fd 100644 --- a/maxkey-common/src/test/java/org/maxkey/crypto/signature/DsaSignerTest.java +++ b/maxkey-common/src/test/java/org/maxkey/crypto/signature/DsaSignerTest.java @@ -21,7 +21,6 @@ import java.util.Map; import org.junit.Test; import org.maxkey.crypto.KeyPairUtil; -import org.maxkey.crypto.signature.DsaSigner; public final class DsaSignerTest { @Test diff --git a/maxkey-common/src/test/java/org/maxkey/crypto/signature/RsaSignerTest.java b/maxkey-common/src/test/java/org/maxkey/crypto/signature/RsaSignerTest.java index 0be0a6198..986124a83 100644 --- a/maxkey-common/src/test/java/org/maxkey/crypto/signature/RsaSignerTest.java +++ b/maxkey-common/src/test/java/org/maxkey/crypto/signature/RsaSignerTest.java @@ -24,7 +24,6 @@ import java.util.Map; import org.junit.Test; import org.maxkey.crypto.KeyPairUtil; -import org.maxkey.crypto.signature.RsaSigner; public final class RsaSignerTest { diff --git a/maxkey-common/src/test/java/org/maxkey/mail/MailTest.java b/maxkey-common/src/test/java/org/maxkey/mail/MailTest.java index 26d351e6e..e5ce9718f 100644 --- a/maxkey-common/src/test/java/org/maxkey/mail/MailTest.java +++ b/maxkey-common/src/test/java/org/maxkey/mail/MailTest.java @@ -20,7 +20,6 @@ package org.maxkey.mail; import org.apache.commons.mail.DefaultAuthenticator; import org.apache.commons.mail.Email; import org.apache.commons.mail.SimpleEmail; -import org.junit.Test; public class MailTest { diff --git a/maxkey-common/src/test/java/org/maxkey/otp/algorithm/RQcodeTest.java b/maxkey-common/src/test/java/org/maxkey/otp/algorithm/RQcodeTest.java index e2d42d94a..261f2a04e 100644 --- a/maxkey-common/src/test/java/org/maxkey/otp/algorithm/RQcodeTest.java +++ b/maxkey-common/src/test/java/org/maxkey/otp/algorithm/RQcodeTest.java @@ -95,6 +95,7 @@ END:VCARD "REV:2008-04-24T19:52:43Z\n" + "END:VCARD\n" ; + System.out.println(str); //String str = "CN:男;COP:公司;ZW:职务";// 二维码内容 String path = "D:\\hwy.png"; BitMatrix byteMatrix; diff --git a/maxkey-common/src/test/java/org/maxkey/util/DateUtilsTest.java b/maxkey-common/src/test/java/org/maxkey/util/DateUtilsTest.java index 6c1881eaa..20751c3ca 100644 --- a/maxkey-common/src/test/java/org/maxkey/util/DateUtilsTest.java +++ b/maxkey-common/src/test/java/org/maxkey/util/DateUtilsTest.java @@ -19,8 +19,6 @@ package org.maxkey.util; import java.util.Date; -import org.maxkey.util.DateUtils; - public class DateUtilsTest { /** diff --git a/maxkey-common/src/test/java/org/maxkey/util/EthernetAddressTest.java b/maxkey-common/src/test/java/org/maxkey/util/EthernetAddressTest.java index 7db3af45f..b4e1e0dfb 100644 --- a/maxkey-common/src/test/java/org/maxkey/util/EthernetAddressTest.java +++ b/maxkey-common/src/test/java/org/maxkey/util/EthernetAddressTest.java @@ -17,8 +17,6 @@ package org.maxkey.util; -import org.maxkey.util.EthernetAddress; - public class EthernetAddressTest { public static void main(String[] args) { diff --git a/maxkey-common/src/test/java/org/maxkey/util/MacAddressTest.java b/maxkey-common/src/test/java/org/maxkey/util/MacAddressTest.java index cba766dc6..21f7176f4 100644 --- a/maxkey-common/src/test/java/org/maxkey/util/MacAddressTest.java +++ b/maxkey-common/src/test/java/org/maxkey/util/MacAddressTest.java @@ -17,8 +17,6 @@ package org.maxkey.util; -import org.maxkey.util.MacAddress; - public class MacAddressTest { public static void main(String[] args) { diff --git a/maxkey-common/src/test/java/org/maxkey/util/ObjectTransformerTest.java b/maxkey-common/src/test/java/org/maxkey/util/ObjectTransformerTest.java index 3921ad0dd..eb2168817 100644 --- a/maxkey-common/src/test/java/org/maxkey/util/ObjectTransformerTest.java +++ b/maxkey-common/src/test/java/org/maxkey/util/ObjectTransformerTest.java @@ -18,7 +18,6 @@ package org.maxkey.util; import java.util.HashMap; -import org.maxkey.util.ObjectTransformer; public class ObjectTransformerTest { diff --git a/maxkey-common/src/test/java/org/maxkey/util/PathUtilsTest.java b/maxkey-common/src/test/java/org/maxkey/util/PathUtilsTest.java index 0192a8326..23334bb1f 100644 --- a/maxkey-common/src/test/java/org/maxkey/util/PathUtilsTest.java +++ b/maxkey-common/src/test/java/org/maxkey/util/PathUtilsTest.java @@ -18,7 +18,6 @@ package org.maxkey.util; import org.junit.Test; -import org.maxkey.util.PathUtils; public class PathUtilsTest { @Test diff --git a/maxkey-common/src/test/java/org/maxkey/util/StringGeneratorTest.java b/maxkey-common/src/test/java/org/maxkey/util/StringGeneratorTest.java index 7b654c9b6..3b7a1a9eb 100644 --- a/maxkey-common/src/test/java/org/maxkey/util/StringGeneratorTest.java +++ b/maxkey-common/src/test/java/org/maxkey/util/StringGeneratorTest.java @@ -20,7 +20,6 @@ package org.maxkey.util; import java.util.UUID; import org.junit.Test; -import org.maxkey.util.StringGenerator; public class StringGeneratorTest { @Test diff --git a/maxkey-common/src/test/java/org/maxkey/util/UUIDGeneratorTest.java b/maxkey-common/src/test/java/org/maxkey/util/UUIDGeneratorTest.java index cf01ee6b9..21546359d 100644 --- a/maxkey-common/src/test/java/org/maxkey/util/UUIDGeneratorTest.java +++ b/maxkey-common/src/test/java/org/maxkey/util/UUIDGeneratorTest.java @@ -22,7 +22,6 @@ import java.util.Date; import org.maxkey.uuid.UUID; import org.junit.Test; -import org.maxkey.util.UUIDGenerator; public class UUIDGeneratorTest { diff --git a/maxkey-common/src/test/java/org/maxkey/util/XMLHelperTest.java b/maxkey-common/src/test/java/org/maxkey/util/XMLHelperTest.java index eee2076de..19b34b10c 100644 --- a/maxkey-common/src/test/java/org/maxkey/util/XMLHelperTest.java +++ b/maxkey-common/src/test/java/org/maxkey/util/XMLHelperTest.java @@ -17,24 +17,8 @@ package org.maxkey.util; -import java.io.OutputStream; -import java.io.StringWriter; -import java.io.Writer; -import java.util.Map; - import org.junit.Test; -import org.maxkey.pretty.PrettyFactory; import org.maxkey.pretty.impl.XMLHelper; -import org.w3c.dom.DOMConfiguration; -import org.w3c.dom.DOMImplementation; -import org.w3c.dom.Document; -import org.w3c.dom.Node; -import org.w3c.dom.ls.DOMImplementationLS; -import org.w3c.dom.ls.LSOutput; -import org.w3c.dom.ls.LSSerializer; -import org.w3c.dom.ls.LSSerializerFilter; - -import net.shibboleth.utilities.java.support.collection.LazyMap; public class XMLHelperTest { diff --git a/maxkey-core/src/main/java/org/maxkey/autoconfigure/MvcAutoConfiguration.java b/maxkey-core/src/main/java/org/maxkey/autoconfigure/MvcAutoConfiguration.java index 200ace3cb..3f83a381b 100644 --- a/maxkey-core/src/main/java/org/maxkey/autoconfigure/MvcAutoConfiguration.java +++ b/maxkey-core/src/main/java/org/maxkey/autoconfigure/MvcAutoConfiguration.java @@ -32,7 +32,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.InitializingBean; import org.springframework.beans.factory.annotation.Value; -import org.springframework.boot.actuate.endpoint.http.ActuatorMediaType; +import org.springframework.boot.actuate.endpoint.ApiVersion; import org.springframework.boot.web.server.ConfigurableWebServerFactory; import org.springframework.boot.web.server.ErrorPage; import org.springframework.boot.web.server.WebServerFactoryCustomizer; @@ -164,6 +164,7 @@ public class MvcAutoConfiguration implements InitializingBean { mediaTypesList.add(MediaType.APPLICATION_XML); mediaTypesList.add(MediaType.TEXT_XML); mediaTypesList.add(MediaType.TEXT_PLAIN); + _logger.debug("marshallingHttpMessageConverter MediaTypes " + mediaTypesList); marshallingHttpMessageConverter.setSupportedMediaTypes(mediaTypesList); return marshallingHttpMessageConverter; } @@ -178,9 +179,10 @@ public class MvcAutoConfiguration implements InitializingBean { new MappingJackson2HttpMessageConverter(); ArrayList mediaTypesList = new ArrayList(); mediaTypesList.add(MediaType.APPLICATION_JSON); - mediaTypesList.add(MediaType.valueOf(ActuatorMediaType.V2_JSON)); - mediaTypesList.add(MediaType.valueOf(ActuatorMediaType.V3_JSON)); + mediaTypesList.add(MediaType.valueOf(ApiVersion.V2.getProducedMimeType().toString())); + mediaTypesList.add(MediaType.valueOf(ApiVersion.V3.getProducedMimeType().toString())); //mediaTypesList.add(MediaType.TEXT_PLAIN); + _logger.debug("mappingJacksonHttpMessageConverter MediaTypes " + mediaTypesList); mappingJacksonHttpMessageConverter.setSupportedMediaTypes(mediaTypesList); return mappingJacksonHttpMessageConverter; } @@ -191,8 +193,8 @@ public class MvcAutoConfiguration implements InitializingBean { */ @Bean (name = "stringHttpMessageConverter") public HttpMessageConverter responseBodyConverter() { - StringHttpMessageConverter stringHttpMessageConverter = new StringHttpMessageConverter( - Charset.forName("UTF-8")); + StringHttpMessageConverter stringHttpMessageConverter = + new StringHttpMessageConverter(Charset.forName("UTF-8")); return stringHttpMessageConverter; } diff --git a/maxkey-core/src/main/java/org/maxkey/autoconfigure/SwaggerConfig.java b/maxkey-core/src/main/java/org/maxkey/autoconfigure/SwaggerConfig.java index f9dff8e49..2cd24d987 100644 --- a/maxkey-core/src/main/java/org/maxkey/autoconfigure/SwaggerConfig.java +++ b/maxkey-core/src/main/java/org/maxkey/autoconfigure/SwaggerConfig.java @@ -52,6 +52,7 @@ public class SwaggerConfig { } // 配置swagger信息 + @SuppressWarnings(value = { }) private ApiInfo apiInfo() { Contact contact = new Contact( "MaxKey.top", @@ -66,6 +67,6 @@ public class SwaggerConfig { contact, "Apache License, Version 2.0", "http://www.apache.org/licenses/LICENSE-2.0", - new ArrayList()); + new ArrayList<>()); } } diff --git a/maxkey-core/src/main/java/org/maxkey/configuration/ApplicationConfig.java b/maxkey-core/src/main/java/org/maxkey/configuration/ApplicationConfig.java index 1fd949e86..74989ce0c 100644 --- a/maxkey-core/src/main/java/org/maxkey/configuration/ApplicationConfig.java +++ b/maxkey-core/src/main/java/org/maxkey/configuration/ApplicationConfig.java @@ -17,8 +17,6 @@ package org.maxkey.configuration; -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.Configuration; @@ -37,8 +35,7 @@ import org.springframework.stereotype.Component; @Component @Configuration public class ApplicationConfig { - private static final Logger _logger = LoggerFactory.getLogger(ApplicationConfig.class); - + @Autowired EmailConfig emailConfig; diff --git a/maxkey-core/src/main/java/org/maxkey/entity/xml/UserInfoXML.java b/maxkey-core/src/main/java/org/maxkey/entity/xml/UserInfoXML.java index 3421c8487..ce0a64698 100644 --- a/maxkey-core/src/main/java/org/maxkey/entity/xml/UserInfoXML.java +++ b/maxkey-core/src/main/java/org/maxkey/entity/xml/UserInfoXML.java @@ -19,7 +19,6 @@ package org.maxkey.entity.xml; import javax.xml.bind.annotation.XmlRootElement; -import org.apache.mybatis.jpa.persistence.JpaBaseEntity; import org.apache.mybatis.jpa.persistence.JpaBaseEntity; /** diff --git a/maxkey-core/src/main/java/org/maxkey/persistence/redis/RedisConnection.java b/maxkey-core/src/main/java/org/maxkey/persistence/redis/RedisConnection.java index fcc8ace36..5772af0f0 100644 --- a/maxkey-core/src/main/java/org/maxkey/persistence/redis/RedisConnection.java +++ b/maxkey-core/src/main/java/org/maxkey/persistence/redis/RedisConnection.java @@ -67,7 +67,7 @@ public class RedisConnection { * @param seconds * @param value */ - public void setex(String key,int seconds, String value){ + public void setex(String key,long seconds, String value){ if(seconds==0){ conn.setex(key, RedisConnectionFactory.DEFAULT_CONFIG.DEFAULT_LIFETIME, value); }else{ @@ -103,7 +103,7 @@ public class RedisConnection { return null; } - public void expire(String key,int seconds){ + public void expire(String key,long seconds){ conn.expire(key, seconds); } diff --git a/maxkey-core/src/main/java/org/maxkey/persistence/redis/RedisConnectionFactory.java b/maxkey-core/src/main/java/org/maxkey/persistence/redis/RedisConnectionFactory.java index 38c8b8ee0..caf5e7718 100644 --- a/maxkey-core/src/main/java/org/maxkey/persistence/redis/RedisConnectionFactory.java +++ b/maxkey-core/src/main/java/org/maxkey/persistence/redis/RedisConnectionFactory.java @@ -61,7 +61,7 @@ public class RedisConnectionFactory { /** * 默认过期时间 */ - public static int DEFAULT_LIFETIME = 600; + public static long DEFAULT_LIFETIME = 600; } JedisPoolConfig poolConfig; diff --git a/maxkey-core/src/main/java/org/maxkey/web/tag/BasePathTagDirective.java b/maxkey-core/src/main/java/org/maxkey/web/tag/BasePathTagDirective.java index 217b92670..c57d73e7c 100644 --- a/maxkey-core/src/main/java/org/maxkey/web/tag/BasePathTagDirective.java +++ b/maxkey-core/src/main/java/org/maxkey/web/tag/BasePathTagDirective.java @@ -45,6 +45,7 @@ public class BasePathTagDirective implements TemplateDirectiveModel { private HttpServletRequest request; @Override + @SuppressWarnings("rawtypes") public void execute(Environment env, Map params, TemplateModel[] loopVars, TemplateDirectiveBody body) throws TemplateException, IOException { diff --git a/maxkey-core/src/main/java/org/maxkey/web/tag/BaseTagDirective.java b/maxkey-core/src/main/java/org/maxkey/web/tag/BaseTagDirective.java index 7c19226a8..287809dab 100644 --- a/maxkey-core/src/main/java/org/maxkey/web/tag/BaseTagDirective.java +++ b/maxkey-core/src/main/java/org/maxkey/web/tag/BaseTagDirective.java @@ -42,6 +42,7 @@ public class BaseTagDirective implements TemplateDirectiveModel { private HttpServletRequest request; @Override + @SuppressWarnings("rawtypes") public void execute(Environment env, Map params, TemplateModel[] loopVars, TemplateDirectiveBody body) throws TemplateException, IOException { //String url = params.get(URL).toString(); diff --git a/maxkey-core/src/main/java/org/maxkey/web/tag/BrowserTagDirective.java b/maxkey-core/src/main/java/org/maxkey/web/tag/BrowserTagDirective.java index ebeb816ae..7ee95a4f3 100644 --- a/maxkey-core/src/main/java/org/maxkey/web/tag/BrowserTagDirective.java +++ b/maxkey-core/src/main/java/org/maxkey/web/tag/BrowserTagDirective.java @@ -42,6 +42,7 @@ public class BrowserTagDirective implements TemplateDirectiveModel { private HttpServletRequest request; @Override + @SuppressWarnings("rawtypes") public void execute(Environment env, Map params, TemplateModel[] loopVars, TemplateDirectiveBody body) throws TemplateException, IOException { String browser = params.get("name").toString(); diff --git a/maxkey-core/src/main/java/org/maxkey/web/tag/CurrUrlTagDirective.java b/maxkey-core/src/main/java/org/maxkey/web/tag/CurrUrlTagDirective.java index a5708fd72..1c3139d66 100644 --- a/maxkey-core/src/main/java/org/maxkey/web/tag/CurrUrlTagDirective.java +++ b/maxkey-core/src/main/java/org/maxkey/web/tag/CurrUrlTagDirective.java @@ -42,6 +42,7 @@ public class CurrUrlTagDirective implements TemplateDirectiveModel { private HttpServletRequest request; @Override + @SuppressWarnings("rawtypes") public void execute(Environment env, Map params, TemplateModel[] loopVars, TemplateDirectiveBody body) throws TemplateException, IOException { //String url = params.get(URL).toString(); diff --git a/maxkey-core/src/main/java/org/maxkey/web/tag/DateTagDirective.java b/maxkey-core/src/main/java/org/maxkey/web/tag/DateTagDirective.java index 132733d80..27d953bb8 100644 --- a/maxkey-core/src/main/java/org/maxkey/web/tag/DateTagDirective.java +++ b/maxkey-core/src/main/java/org/maxkey/web/tag/DateTagDirective.java @@ -20,10 +20,7 @@ package org.maxkey.web.tag; import java.io.IOException; import java.util.Map; -import javax.servlet.http.HttpServletRequest; - import org.maxkey.util.DateUtils; -import org.springframework.beans.factory.annotation.Autowired; import freemarker.core.Environment; import freemarker.template.TemplateDirectiveBody; @@ -39,10 +36,9 @@ import freemarker.template.TemplateModel; @FreemarkerTag("date") public class DateTagDirective implements TemplateDirectiveModel { - @Autowired - private HttpServletRequest request; - + @Override + @SuppressWarnings("rawtypes") public void execute(Environment env, Map params, TemplateModel[] loopVars, TemplateDirectiveBody body) throws TemplateException, IOException { String dateValue = params.get("value").toString(); diff --git a/maxkey-core/src/main/java/org/maxkey/web/tag/DialogTagDirective.java b/maxkey-core/src/main/java/org/maxkey/web/tag/DialogTagDirective.java index 344061c43..08c582a70 100644 --- a/maxkey-core/src/main/java/org/maxkey/web/tag/DialogTagDirective.java +++ b/maxkey-core/src/main/java/org/maxkey/web/tag/DialogTagDirective.java @@ -22,7 +22,6 @@ import java.util.Map; import javax.servlet.http.HttpServletRequest; -import org.maxkey.util.DateUtils; import org.springframework.beans.factory.annotation.Autowired; import freemarker.core.Environment; @@ -53,6 +52,7 @@ public class DialogTagDirective implements TemplateDirectiveModel { private String text; @Override + @SuppressWarnings("rawtypes") public void execute(Environment env, Map params, TemplateModel[] loopVars, TemplateDirectiveBody body) throws TemplateException, IOException { diff --git a/maxkey-core/src/main/java/org/maxkey/web/tag/GenIdTagDirective.java b/maxkey-core/src/main/java/org/maxkey/web/tag/GenIdTagDirective.java index c026a28be..c85dd8007 100644 --- a/maxkey-core/src/main/java/org/maxkey/web/tag/GenIdTagDirective.java +++ b/maxkey-core/src/main/java/org/maxkey/web/tag/GenIdTagDirective.java @@ -37,6 +37,7 @@ import freemarker.template.TemplateModel; public class GenIdTagDirective implements TemplateDirectiveModel { @Override + @SuppressWarnings("rawtypes") public void execute(Environment env, Map params, TemplateModel[] loopVars, TemplateDirectiveBody body) throws TemplateException, IOException { env.getOut().append(UUID.randomUUID().toString().toLowerCase()); diff --git a/maxkey-core/src/main/java/org/maxkey/web/tag/ParameterTagDirective.java b/maxkey-core/src/main/java/org/maxkey/web/tag/ParameterTagDirective.java index caeee06ab..e8e0ec234 100644 --- a/maxkey-core/src/main/java/org/maxkey/web/tag/ParameterTagDirective.java +++ b/maxkey-core/src/main/java/org/maxkey/web/tag/ParameterTagDirective.java @@ -45,6 +45,7 @@ public class ParameterTagDirective implements TemplateDirectiveModel { @Override + @SuppressWarnings("rawtypes") public void execute(Environment env, Map params, TemplateModel[] loopVars, TemplateDirectiveBody body) throws TemplateException, IOException { name=params.get("name").toString(); diff --git a/maxkey-core/src/main/java/org/maxkey/web/tag/PathVarTagDirective.java b/maxkey-core/src/main/java/org/maxkey/web/tag/PathVarTagDirective.java index 4d76f7736..12b681b20 100644 --- a/maxkey-core/src/main/java/org/maxkey/web/tag/PathVarTagDirective.java +++ b/maxkey-core/src/main/java/org/maxkey/web/tag/PathVarTagDirective.java @@ -45,6 +45,7 @@ public class PathVarTagDirective implements TemplateDirectiveModel { String pathVariable; @Override + @SuppressWarnings("rawtypes") public void execute(Environment env, Map params, TemplateModel[] loopVars, TemplateDirectiveBody body) throws TemplateException, IOException { diff --git a/maxkey-core/src/main/java/org/maxkey/web/tag/RedirectTagDirective.java b/maxkey-core/src/main/java/org/maxkey/web/tag/RedirectTagDirective.java index 2f58c1c57..e844e79a8 100644 --- a/maxkey-core/src/main/java/org/maxkey/web/tag/RedirectTagDirective.java +++ b/maxkey-core/src/main/java/org/maxkey/web/tag/RedirectTagDirective.java @@ -18,18 +18,12 @@ package org.maxkey.web.tag; import java.io.IOException; -import java.util.Locale; import java.util.Map; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.servlet.support.RequestContextUtils; -import org.springframework.web.context.WebApplicationContext; -import org.springframework.web.servlet.support.RequestContext; -import org.springframework.web.servlet.tags.RequestContextAwareTag; - import freemarker.core.Environment; import freemarker.template.TemplateDirectiveBody; import freemarker.template.TemplateDirectiveModel; @@ -51,6 +45,7 @@ public class RedirectTagDirective implements TemplateDirectiveModel { private String basePath = null; @Override + @SuppressWarnings("rawtypes") public void execute(Environment env, Map params, TemplateModel[] loopVars, TemplateDirectiveBody body) throws TemplateException, IOException { String location=params.get("url").toString(); diff --git a/maxkey-core/src/main/java/org/maxkey/web/tag/StaticTagDirective.java b/maxkey-core/src/main/java/org/maxkey/web/tag/StaticTagDirective.java index 22f57d53a..ea8c70c63 100644 --- a/maxkey-core/src/main/java/org/maxkey/web/tag/StaticTagDirective.java +++ b/maxkey-core/src/main/java/org/maxkey/web/tag/StaticTagDirective.java @@ -38,6 +38,7 @@ public class StaticTagDirective implements TemplateDirectiveModel { @Override + @SuppressWarnings("rawtypes") public void execute(Environment env, Map params, TemplateModel[] loopVars, TemplateDirectiveBody body) throws TemplateException, IOException { diff --git a/maxkey-core/src/main/java/org/maxkey/web/tag/TreeTagDirective.java b/maxkey-core/src/main/java/org/maxkey/web/tag/TreeTagDirective.java index c045f60bd..d5713545f 100644 --- a/maxkey-core/src/main/java/org/maxkey/web/tag/TreeTagDirective.java +++ b/maxkey-core/src/main/java/org/maxkey/web/tag/TreeTagDirective.java @@ -59,6 +59,7 @@ public class TreeTagDirective implements TemplateDirectiveModel { @Override + @SuppressWarnings("rawtypes") public void execute(Environment env, Map params, TemplateModel[] loopVars, TemplateDirectiveBody body) throws TemplateException, IOException { id = params.get("id").toString(); diff --git a/maxkey-core/src/test/java/org/maxkey/EscapeHtml4Test.java b/maxkey-core/src/test/java/org/maxkey/EscapeHtml4Test.java index b7a48829b..5510981b7 100644 --- a/maxkey-core/src/test/java/org/maxkey/EscapeHtml4Test.java +++ b/maxkey-core/src/test/java/org/maxkey/EscapeHtml4Test.java @@ -20,11 +20,13 @@ package org.maxkey; import java.sql.SQLException; import org.apache.commons.text.StringEscapeUtils; +import org.springframework.boot.actuate.endpoint.ApiVersion; public class EscapeHtml4Test { public static void main(String[] args) throws SQLException { String value=">"; System.out.println(StringEscapeUtils.escapeHtml4(value)); System.out.println(StringEscapeUtils.escapeEcmaScript(value)); + System.out.println(ApiVersion.V2.getProducedMimeType().toString()); } } diff --git a/maxkey-core/src/test/java/org/maxkey/persistence/ldap/ActiveDirectoryUtilsTest.java b/maxkey-core/src/test/java/org/maxkey/persistence/ldap/ActiveDirectoryUtilsTest.java index 1af3c6cef..d2eb91f6d 100644 --- a/maxkey-core/src/test/java/org/maxkey/persistence/ldap/ActiveDirectoryUtilsTest.java +++ b/maxkey-core/src/test/java/org/maxkey/persistence/ldap/ActiveDirectoryUtilsTest.java @@ -20,8 +20,6 @@ package org.maxkey.persistence.ldap; import javax.naming.NamingException; import javax.naming.directory.DirContext; -import org.maxkey.persistence.ldap.ActiveDirectoryUtils; - public class ActiveDirectoryUtilsTest { public static void main(String[] args) throws Exception { String trustStore="D:/JavaIDE/jdk1.6.0_30/jre/lib/security/cacerts"; diff --git a/maxkey-gataway/src/main/resources/application.yml b/maxkey-gataway/src/main/resources/application.yml index 1010f3b78..2fbd5cad4 100644 --- a/maxkey-gataway/src/main/resources/application.yml +++ b/maxkey-gataway/src/main/resources/application.yml @@ -1,7 +1,7 @@ #端口号 application: name: maxkey-gateway-server - formatted-version: v2.9.0 GA + formatted-version: v3.0.0 GA server: port: 9000 spring: diff --git a/maxkey-identitys/maxkey-identity-scim/src/main/java/org/maxkey/identity/scim/controller/ScimOrganizationController.java b/maxkey-identitys/maxkey-identity-scim/src/main/java/org/maxkey/identity/scim/controller/ScimOrganizationController.java index 790b66f71..c78a0bd04 100644 --- a/maxkey-identitys/maxkey-identity-scim/src/main/java/org/maxkey/identity/scim/controller/ScimOrganizationController.java +++ b/maxkey-identitys/maxkey-identity-scim/src/main/java/org/maxkey/identity/scim/controller/ScimOrganizationController.java @@ -59,7 +59,7 @@ public class ScimOrganizationController { public ResponseEntity create(@RequestBody Organization user, @RequestParam(required = false) String attributes, UriComponentsBuilder builder) throws IOException { - Organization createdUser = null; + //Organization createdUser = null; return null; } @@ -68,7 +68,7 @@ public class ScimOrganizationController { @RequestBody Organization user, @RequestParam(required = false) String attributes) throws IOException { - Organization createdUser = null; + //Organization createdUser = null; return null; } @@ -86,7 +86,7 @@ public class ScimOrganizationController { @RequestMapping(value = "/.search", method = RequestMethod.POST) public MappingJacksonValue searchWithPost(@RequestParam Map requestParameters) { - ScimSearchResult scimSearchResult = null; + //ScimSearchResult scimSearchResult = null; /* requestParameters.get("filter"), requestParameters.get("sortBy"), @@ -94,7 +94,8 @@ public class ScimOrganizationController { Integer.parseInt(requestParameters.getOrDefault("count", "" + ScimServiceProviderConfigController.MAX_RESULTS)), Integer.parseInt(requestParameters.getOrDefault("startIndex", "1")); // scim default */ - String attributes = (requestParameters.containsKey("attributes") ? requestParameters.get("attributes") : ""); + //String attributes = (requestParameters.containsKey("attributes") ? requestParameters.get("attributes") : ""); + return null; } } diff --git a/maxkey-identitys/maxkey-identity-scim/src/main/java/org/maxkey/identity/scim/controller/ScimUserController.java b/maxkey-identitys/maxkey-identity-scim/src/main/java/org/maxkey/identity/scim/controller/ScimUserController.java index 87fd4e324..ed65406f2 100644 --- a/maxkey-identitys/maxkey-identity-scim/src/main/java/org/maxkey/identity/scim/controller/ScimUserController.java +++ b/maxkey-identitys/maxkey-identity-scim/src/main/java/org/maxkey/identity/scim/controller/ScimUserController.java @@ -50,7 +50,7 @@ public class ScimUserController { @RequestMapping(value = "/{id}", method = RequestMethod.GET) public MappingJacksonValue getUser(@PathVariable String id, @RequestParam(required = false) String attributes) { - User user = null; + //User user = null; return null; } @@ -58,7 +58,7 @@ public class ScimUserController { public ResponseEntity create(@RequestBody User user, @RequestParam(required = false) String attributes, UriComponentsBuilder builder) throws IOException { - User createdUser = null; + //User createdUser = null; return null; } @@ -67,7 +67,7 @@ public class ScimUserController { @RequestBody User user, @RequestParam(required = false) String attributes) throws IOException { - User createdUser = null; + //User createdUser = null; return null; } @@ -85,7 +85,7 @@ public class ScimUserController { @RequestMapping(value = "/.search", method = RequestMethod.POST) public MappingJacksonValue searchWithPost(@RequestParam Map requestParameters) { - ScimSearchResult scimSearchResult = null; + //ScimSearchResult scimSearchResult = null; /* requestParameters.get("filter"), requestParameters.get("sortBy"), @@ -93,7 +93,7 @@ public class ScimUserController { Integer.parseInt(requestParameters.getOrDefault("count", "" + ScimServiceProviderConfigController.MAX_RESULTS)), Integer.parseInt(requestParameters.getOrDefault("startIndex", "1")); // scim default */ - String attributes = (requestParameters.containsKey("attributes") ? requestParameters.get("attributes") : ""); + //String attributes = (requestParameters.containsKey("attributes") ? requestParameters.get("attributes") : ""); return null; } } diff --git a/maxkey-identitys/maxkey-identity-scim/src/test/java/org/maxkey/identity/scim/resources/ScimGroupJsonString2ObjectTest.java b/maxkey-identitys/maxkey-identity-scim/src/test/java/org/maxkey/identity/scim/resources/ScimGroupJsonString2ObjectTest.java index 2682ec7ce..092333e30 100644 --- a/maxkey-identitys/maxkey-identity-scim/src/test/java/org/maxkey/identity/scim/resources/ScimGroupJsonString2ObjectTest.java +++ b/maxkey-identitys/maxkey-identity-scim/src/test/java/org/maxkey/identity/scim/resources/ScimGroupJsonString2ObjectTest.java @@ -17,10 +17,6 @@ package org.maxkey.identity.scim.resources; -import java.util.Date; -import java.util.HashSet; -import java.util.Set; - import org.maxkey.pretty.impl.JsonPretty; import org.maxkey.util.JsonUtils; diff --git a/maxkey-persistence/src/test/java/org/apache/mybatis/jpa/test/FormBasedDetailsServiceTest.java b/maxkey-persistence/src/test/java/org/apache/mybatis/jpa/test/FormBasedDetailsServiceTest.java index ec965a158..2fea3bb40 100644 --- a/maxkey-persistence/src/test/java/org/apache/mybatis/jpa/test/FormBasedDetailsServiceTest.java +++ b/maxkey-persistence/src/test/java/org/apache/mybatis/jpa/test/FormBasedDetailsServiceTest.java @@ -94,12 +94,8 @@ public class FormBasedDetailsServiceTest { _logger.info("queryPageResults..."); AppsFormBasedDetails formBasedDetails=new AppsFormBasedDetails(); - //student.setId("af04d610-6092-481e-9558-30bd63ef783c"); - // student.setStdGender("M"); - //student.setStdMajor(政治"); - //student.setPageResults(10); - //student.setPage(2); - //_logger.info("queryPageResults "+service.queryPageResults(formBasedDetails)); + formBasedDetails.setPageNumber(2); + _logger.info("queryPageResults "+service.queryPageResults(formBasedDetails)); } @Test @@ -107,12 +103,10 @@ public class FormBasedDetailsServiceTest { _logger.info("queryPageResults by mapperId..."); AppsFormBasedDetails formBasedDetails=new AppsFormBasedDetails(); - // student.setStdGender("M"); - //student.setStdMajor(政治"); - // student.setPageResults(10); - // student.setPage(2); + + formBasedDetails.setPageNumber(2); - //_logger.info("queryPageResults by mapperId "+service.queryPageResults("queryPageResults1",formBasedDetails)); + _logger.info("queryPageResults by mapperId "+service.queryPageResults("queryPageResults1",formBasedDetails)); } diff --git a/maxkey-protocols/maxkey-protocol-cas/src/main/java/org/maxkey/authz/cas/endpoint/ticket/AbstractTicketException.java b/maxkey-protocols/maxkey-protocol-cas/src/main/java/org/maxkey/authz/cas/endpoint/ticket/AbstractTicketException.java index fb4fcc0b4..e7680e820 100644 --- a/maxkey-protocols/maxkey-protocol-cas/src/main/java/org/maxkey/authz/cas/endpoint/ticket/AbstractTicketException.java +++ b/maxkey-protocols/maxkey-protocol-cas/src/main/java/org/maxkey/authz/cas/endpoint/ticket/AbstractTicketException.java @@ -25,8 +25,6 @@ package org.maxkey.authz.cas.endpoint.ticket; * @since 4.2.0 */ public abstract class AbstractTicketException{ - private static final long serialVersionUID = -5128676415951733624L; - String code; String msg; Throwable throwable; diff --git a/maxkey-protocols/maxkey-protocol-cas/src/main/java/org/maxkey/authz/cas/endpoint/ticket/AbstractWebApplicationService.java b/maxkey-protocols/maxkey-protocol-cas/src/main/java/org/maxkey/authz/cas/endpoint/ticket/AbstractWebApplicationService.java index 6d82ce606..ae77d40f5 100644 --- a/maxkey-protocols/maxkey-protocol-cas/src/main/java/org/maxkey/authz/cas/endpoint/ticket/AbstractWebApplicationService.java +++ b/maxkey-protocols/maxkey-protocol-cas/src/main/java/org/maxkey/authz/cas/endpoint/ticket/AbstractWebApplicationService.java @@ -33,8 +33,6 @@ import org.slf4j.LoggerFactory; */ public abstract class AbstractWebApplicationService { - private static final long serialVersionUID = 610105280927740076L; - /** Logger instance. **/ protected static final Logger LOGGER = LoggerFactory.getLogger(AbstractWebApplicationService.class); diff --git a/maxkey-protocols/maxkey-protocol-cas/src/main/java/org/maxkey/authz/cas/endpoint/ticket/Service.java b/maxkey-protocols/maxkey-protocol-cas/src/main/java/org/maxkey/authz/cas/endpoint/ticket/Service.java index c44229353..886fbb2ef 100644 --- a/maxkey-protocols/maxkey-protocol-cas/src/main/java/org/maxkey/authz/cas/endpoint/ticket/Service.java +++ b/maxkey-protocols/maxkey-protocol-cas/src/main/java/org/maxkey/authz/cas/endpoint/ticket/Service.java @@ -31,7 +31,7 @@ package org.maxkey.authz.cas.endpoint.ticket; *

*/ public interface Service { - boolean getId(); + String getId(); boolean matches(Service service); } diff --git a/maxkey-protocols/maxkey-protocol-cas/src/main/java/org/maxkey/authz/cas/endpoint/ticket/SimpleWebApplicationServiceImpl.java b/maxkey-protocols/maxkey-protocol-cas/src/main/java/org/maxkey/authz/cas/endpoint/ticket/SimpleWebApplicationServiceImpl.java index e4eb86046..1f76b02bf 100644 --- a/maxkey-protocols/maxkey-protocol-cas/src/main/java/org/maxkey/authz/cas/endpoint/ticket/SimpleWebApplicationServiceImpl.java +++ b/maxkey-protocols/maxkey-protocol-cas/src/main/java/org/maxkey/authz/cas/endpoint/ticket/SimpleWebApplicationServiceImpl.java @@ -26,8 +26,6 @@ package org.maxkey.authz.cas.endpoint.ticket; */ public final class SimpleWebApplicationServiceImpl extends AbstractWebApplicationService { - private static final long serialVersionUID = 8334068957483758042L; - public SimpleWebApplicationServiceImpl(final String id) { this(id, id, null); } diff --git a/maxkey-protocols/maxkey-protocol-cas/src/main/java/org/maxkey/authz/cas/endpoint/ticket/generator/InetAddressUtils.java b/maxkey-protocols/maxkey-protocol-cas/src/main/java/org/maxkey/authz/cas/endpoint/ticket/generator/InetAddressUtils.java index 189e15f4a..9957a9941 100644 --- a/maxkey-protocols/maxkey-protocol-cas/src/main/java/org/maxkey/authz/cas/endpoint/ticket/generator/InetAddressUtils.java +++ b/maxkey-protocols/maxkey-protocol-cas/src/main/java/org/maxkey/authz/cas/endpoint/ticket/generator/InetAddressUtils.java @@ -17,9 +17,6 @@ package org.maxkey.authz.cas.endpoint.ticket.generator; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import java.net.InetAddress; /** @@ -29,8 +26,7 @@ import java.net.InetAddress; * @since 5.0.0 */ public final class InetAddressUtils { - private static final Logger logger = LoggerFactory.getLogger(InetAddressUtils.class); - + private InetAddressUtils() { } diff --git a/maxkey-protocols/maxkey-protocol-cas/src/test/java/org/maxkey/web/authorize/endpoint/RestTestClient.java b/maxkey-protocols/maxkey-protocol-cas/src/test/java/org/maxkey/web/authorize/endpoint/RestTestClient.java index 4a1767965..257770ee9 100644 --- a/maxkey-protocols/maxkey-protocol-cas/src/test/java/org/maxkey/web/authorize/endpoint/RestTestClient.java +++ b/maxkey-protocols/maxkey-protocol-cas/src/test/java/org/maxkey/web/authorize/endpoint/RestTestClient.java @@ -42,7 +42,6 @@ public class RestTestClient { String password ="maxkey"; String serviceUrl = "http://cas.demo.maxkey.top:9521/demo-cas/"; CasConfiguration casConfiguration = new CasConfiguration(casUrlPrefix); - final CasRestAuthenticator authenticator = new CasRestAuthenticator(casConfiguration); final CasRestFormClient client = new CasRestFormClient(casConfiguration,"username","password"); final MockHttpServletRequest request = new MockHttpServletRequest(); final MockHttpServletResponse response = new MockHttpServletResponse(); @@ -61,7 +60,7 @@ public class RestTestClient { Map attributes = casProfile.getAttributes(); Set> mapEntries = attributes.entrySet(); - for (Map.Entry entry : mapEntries) { + for (Map.Entry entry : mapEntries) { System.out.println(entry.getKey() + ":" + entry.getValue()); } client.destroyTicketGrantingTicket(profile,webContext); diff --git a/maxkey-protocols/maxkey-protocol-extendapi/src/main/java/org/maxkey/authz/exapi/endpoint/adapter/ExtendApiCndnsApiMailAdapter.java b/maxkey-protocols/maxkey-protocol-extendapi/src/main/java/org/maxkey/authz/exapi/endpoint/adapter/ExtendApiCndnsApiMailAdapter.java index d86659e6e..b15408aa2 100644 --- a/maxkey-protocols/maxkey-protocol-extendapi/src/main/java/org/maxkey/authz/exapi/endpoint/adapter/ExtendApiCndnsApiMailAdapter.java +++ b/maxkey-protocols/maxkey-protocol-extendapi/src/main/java/org/maxkey/authz/exapi/endpoint/adapter/ExtendApiCndnsApiMailAdapter.java @@ -64,7 +64,8 @@ public class ExtendApiCndnsApiMailAdapter extends AbstractAuthorizeAdapter { return null; } - @Override + @SuppressWarnings("unchecked") + @Override public ModelAndView authorize(UserInfo userInfo, Object app, String data,ModelAndView modelAndView) { HttpsTrusts.beforeConnection(); diff --git a/maxkey-protocols/maxkey-protocol-extendapi/src/main/java/org/maxkey/authz/exapi/endpoint/adapter/ExtendApiQQExmailAdapter.java b/maxkey-protocols/maxkey-protocol-extendapi/src/main/java/org/maxkey/authz/exapi/endpoint/adapter/ExtendApiQQExmailAdapter.java index f75ab77c5..d8e90f3d9 100644 --- a/maxkey-protocols/maxkey-protocol-extendapi/src/main/java/org/maxkey/authz/exapi/endpoint/adapter/ExtendApiQQExmailAdapter.java +++ b/maxkey-protocols/maxkey-protocol-extendapi/src/main/java/org/maxkey/authz/exapi/endpoint/adapter/ExtendApiQQExmailAdapter.java @@ -53,18 +53,21 @@ public class ExtendApiQQExmailAdapter extends AbstractAuthorizeAdapter { return null; } - @Override + @SuppressWarnings("unchecked") + @Override public ModelAndView authorize(UserInfo userInfo, Object app, String data,ModelAndView modelAndView) { HttpsTrusts.beforeConnection(); Apps details=(Apps)app; String username = data.substring(0, data.indexOf("=")); String password = data.substring(data.indexOf("=") + 1); + _logger.trace("username " + username +" password " + password); //extraAttrs from Applications ExtraAttrs extraAttrs=null; if(details.getIsExtendAttr()==1){ extraAttrs=new ExtraAttrs(details.getExtendAttr()); } + _logger.debug("Extra Attrs "+extraAttrs); OAuthClient tokenRestClient=new OAuthClient( String.format(TOKEN_URI,details.getPrincipal(),details.getCredentials())); Token token =tokenRestClient.requestAccessToken(); diff --git a/maxkey-protocols/maxkey-protocol-extendapi/src/main/java/org/maxkey/authz/exapi/endpoint/adapter/ExtendApiZentaoAdapter.java b/maxkey-protocols/maxkey-protocol-extendapi/src/main/java/org/maxkey/authz/exapi/endpoint/adapter/ExtendApiZentaoAdapter.java index 0fa621569..8fbd89d3e 100644 --- a/maxkey-protocols/maxkey-protocol-extendapi/src/main/java/org/maxkey/authz/exapi/endpoint/adapter/ExtendApiZentaoAdapter.java +++ b/maxkey-protocols/maxkey-protocol-extendapi/src/main/java/org/maxkey/authz/exapi/endpoint/adapter/ExtendApiZentaoAdapter.java @@ -62,6 +62,7 @@ public class ExtendApiZentaoAdapter extends AbstractAuthorizeAdapter { if(details.getIsExtendAttr()==1){ extraAttrs=new ExtraAttrs(details.getExtendAttr()); } + _logger.trace("Extra Attrs " + extraAttrs); String code = details.getPrincipal(); String key = details.getCredentials(); String time = ""+Instant.now().getEpochSecond(); diff --git a/maxkey-protocols/maxkey-protocol-oauth-2.0/src/main/java/org/maxkey/authz/oauth2/common/exceptions/OAuth2ExceptionJackson2Serializer.java b/maxkey-protocols/maxkey-protocol-oauth-2.0/src/main/java/org/maxkey/authz/oauth2/common/exceptions/OAuth2ExceptionJackson2Serializer.java index 0741b2efc..f373b1695 100644 --- a/maxkey-protocols/maxkey-protocol-oauth-2.0/src/main/java/org/maxkey/authz/oauth2/common/exceptions/OAuth2ExceptionJackson2Serializer.java +++ b/maxkey-protocols/maxkey-protocol-oauth-2.0/src/main/java/org/maxkey/authz/oauth2/common/exceptions/OAuth2ExceptionJackson2Serializer.java @@ -26,6 +26,11 @@ import com.fasterxml.jackson.databind.ser.std.StdSerializer; */ public class OAuth2ExceptionJackson2Serializer extends StdSerializer { + /** + * + */ + private static final long serialVersionUID = -767680428859994107L; + public OAuth2ExceptionJackson2Serializer() { super(OAuth2Exception.class); } diff --git a/maxkey-protocols/maxkey-protocol-oauth-2.0/src/main/java/org/maxkey/authz/oauth2/jwt/JwtHelper.java b/maxkey-protocols/maxkey-protocol-oauth-2.0/src/main/java/org/maxkey/authz/oauth2/jwt/JwtHelper.java index e67829522..345cba9cb 100644 --- a/maxkey-protocols/maxkey-protocol-oauth-2.0/src/main/java/org/maxkey/authz/oauth2/jwt/JwtHelper.java +++ b/maxkey-protocols/maxkey-protocol-oauth-2.0/src/main/java/org/maxkey/authz/oauth2/jwt/JwtHelper.java @@ -113,7 +113,7 @@ class JwtHeaderHelper { static HeaderParameters parseParams(byte[] header) { JsonParser jp = null; try { - jp = f.createJsonParser(header); + jp = f.createParser(header); String alg = null, enc = null, iv = null; jp.nextToken(); while (jp.nextToken() != JsonToken.END_OBJECT) { @@ -163,7 +163,7 @@ class JwtHeaderHelper { JsonGenerator g = null; try { - g = f.createJsonGenerator(baos); + g = f.createGenerator(baos); g.writeStartObject(); g.writeStringField("alg", params.alg); if (params.enc != null) { diff --git a/maxkey-protocols/maxkey-protocol-oauth-2.0/src/main/java/org/maxkey/authz/oauth2/jwt/codec/Base64Codec.java b/maxkey-protocols/maxkey-protocol-oauth-2.0/src/main/java/org/maxkey/authz/oauth2/jwt/codec/Base64Codec.java index 22589db49..d1d9387a8 100644 --- a/maxkey-protocols/maxkey-protocol-oauth-2.0/src/main/java/org/maxkey/authz/oauth2/jwt/codec/Base64Codec.java +++ b/maxkey-protocols/maxkey-protocol-oauth-2.0/src/main/java/org/maxkey/authz/oauth2/jwt/codec/Base64Codec.java @@ -649,6 +649,11 @@ final class Base64Codec { class InvalidBase64CharacterException extends IllegalArgumentException { + /** + * + */ + private static final long serialVersionUID = -616861303718228577L; + InvalidBase64CharacterException(String message) { super(message); } diff --git a/maxkey-protocols/maxkey-protocol-oauth-2.0/src/main/java/org/maxkey/authz/oauth2/jwt/crypto/sign/InvalidSignatureException.java b/maxkey-protocols/maxkey-protocol-oauth-2.0/src/main/java/org/maxkey/authz/oauth2/jwt/crypto/sign/InvalidSignatureException.java index fb6f3f0ea..2f8bbc2c6 100644 --- a/maxkey-protocols/maxkey-protocol-oauth-2.0/src/main/java/org/maxkey/authz/oauth2/jwt/crypto/sign/InvalidSignatureException.java +++ b/maxkey-protocols/maxkey-protocol-oauth-2.0/src/main/java/org/maxkey/authz/oauth2/jwt/crypto/sign/InvalidSignatureException.java @@ -16,6 +16,11 @@ package org.maxkey.authz.oauth2.jwt.crypto.sign; * @author Luke Taylor */ public class InvalidSignatureException extends RuntimeException { + /** + * + */ + private static final long serialVersionUID = 7078872206905207270L; + public InvalidSignatureException(String message) { super(message); } diff --git a/maxkey-protocols/maxkey-protocol-oauth-2.0/src/main/java/org/maxkey/authz/oauth2/provider/OAuth2UserDetailsService.java b/maxkey-protocols/maxkey-protocol-oauth-2.0/src/main/java/org/maxkey/authz/oauth2/provider/OAuth2UserDetailsService.java index beab3c915..17ca96a8b 100644 --- a/maxkey-protocols/maxkey-protocol-oauth-2.0/src/main/java/org/maxkey/authz/oauth2/provider/OAuth2UserDetailsService.java +++ b/maxkey-protocols/maxkey-protocol-oauth-2.0/src/main/java/org/maxkey/authz/oauth2/provider/OAuth2UserDetailsService.java @@ -20,10 +20,8 @@ import org.maxkey.authn.online.OnlineTicket; import org.maxkey.entity.UserInfo; import org.maxkey.persistence.db.LoginService; import org.maxkey.web.WebConstants; -import org.maxkey.web.WebContext; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.userdetails.UserDetails; import org.springframework.security.core.userdetails.UserDetailsService; diff --git a/maxkey-protocols/maxkey-protocol-oauth-2.0/src/main/java/org/maxkey/authz/oauth2/provider/approval/Approval.java b/maxkey-protocols/maxkey-protocol-oauth-2.0/src/main/java/org/maxkey/authz/oauth2/provider/approval/Approval.java index 1769c6961..6cc1209e0 100644 --- a/maxkey-protocols/maxkey-protocol-oauth-2.0/src/main/java/org/maxkey/authz/oauth2/provider/approval/Approval.java +++ b/maxkey-protocols/maxkey-protocol-oauth-2.0/src/main/java/org/maxkey/authz/oauth2/provider/approval/Approval.java @@ -23,6 +23,7 @@ import org.maxkey.authz.oauth2.common.util.JsonDateDeserializer; import org.maxkey.authz.oauth2.common.util.JsonDateSerializer; import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.fasterxml.jackson.databind.annotation.JsonSerialize; @@ -31,7 +32,7 @@ import com.fasterxml.jackson.databind.annotation.JsonSerialize; * @author Vidya Val * */ -@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL) +@JsonInclude(JsonInclude.Include.NON_NULL) public class Approval { private String userId; @@ -97,7 +98,8 @@ public class Approval { this.scope = scope == null ? "" : scope; } - @JsonSerialize(using = JsonDateSerializer.class, include = JsonSerialize.Inclusion.NON_NULL) + @JsonSerialize(using = JsonDateSerializer.class) + @JsonInclude(JsonInclude.Include.NON_NULL) public Date getExpiresAt() { return expiresAt; } @@ -112,7 +114,8 @@ public class Approval { this.expiresAt = expiresAt; } - @JsonSerialize(using = JsonDateSerializer.class, include = JsonSerialize.Inclusion.NON_NULL) + @JsonSerialize(using = JsonDateSerializer.class) + @JsonInclude(JsonInclude.Include.NON_NULL) public Date getLastUpdatedAt() { return lastUpdatedAt; } diff --git a/maxkey-protocols/maxkey-protocol-oauth-2.0/src/main/java/org/maxkey/authz/oauth2/provider/approval/JdbcApprovalStore.java b/maxkey-protocols/maxkey-protocol-oauth-2.0/src/main/java/org/maxkey/authz/oauth2/provider/approval/JdbcApprovalStore.java index 9fe9fbf7b..3602f878d 100644 --- a/maxkey-protocols/maxkey-protocol-oauth-2.0/src/main/java/org/maxkey/authz/oauth2/provider/approval/JdbcApprovalStore.java +++ b/maxkey-protocols/maxkey-protocol-oauth-2.0/src/main/java/org/maxkey/authz/oauth2/provider/approval/JdbcApprovalStore.java @@ -83,7 +83,7 @@ public class JdbcApprovalStore implements ApprovalStore { private boolean handleRevocationsAsExpiry = false; public JdbcApprovalStore(DataSource dataSource) { - Assert.notNull(dataSource); + Assert.notNull(dataSource,"DataSource must not null"); this.jdbcTemplate = new JdbcTemplate(dataSource); } diff --git a/maxkey-protocols/maxkey-protocol-oauth-2.0/src/main/java/org/maxkey/authz/oauth2/provider/code/RandomValueAuthorizationCodeServices.java b/maxkey-protocols/maxkey-protocol-oauth-2.0/src/main/java/org/maxkey/authz/oauth2/provider/code/RandomValueAuthorizationCodeServices.java index 2adbfaa0a..84dcf417b 100644 --- a/maxkey-protocols/maxkey-protocol-oauth-2.0/src/main/java/org/maxkey/authz/oauth2/provider/code/RandomValueAuthorizationCodeServices.java +++ b/maxkey-protocols/maxkey-protocol-oauth-2.0/src/main/java/org/maxkey/authz/oauth2/provider/code/RandomValueAuthorizationCodeServices.java @@ -20,7 +20,6 @@ package org.maxkey.authz.oauth2.provider.code; import java.util.UUID; import org.maxkey.authz.oauth2.common.exceptions.InvalidGrantException; -import org.maxkey.authz.oauth2.common.util.RandomValueStringGenerator; import org.maxkey.authz.oauth2.provider.OAuth2Authentication; /** @@ -32,7 +31,7 @@ import org.maxkey.authz.oauth2.provider.OAuth2Authentication; public abstract class RandomValueAuthorizationCodeServices implements AuthorizationCodeServices { //default Random code Generator - private RandomValueStringGenerator generator = new RandomValueStringGenerator(); + //private RandomValueStringGenerator generator = new RandomValueStringGenerator(); protected abstract void store(String code, OAuth2Authentication authentication); diff --git a/maxkey-protocols/maxkey-protocol-oauth-2.0/src/main/java/org/maxkey/authz/oauth2/provider/endpoint/CheckTokenEndpoint.java b/maxkey-protocols/maxkey-protocol-oauth-2.0/src/main/java/org/maxkey/authz/oauth2/provider/endpoint/CheckTokenEndpoint.java index 2c56bf10a..15c403e02 100644 --- a/maxkey-protocols/maxkey-protocol-oauth-2.0/src/main/java/org/maxkey/authz/oauth2/provider/endpoint/CheckTokenEndpoint.java +++ b/maxkey-protocols/maxkey-protocol-oauth-2.0/src/main/java/org/maxkey/authz/oauth2/provider/endpoint/CheckTokenEndpoint.java @@ -36,14 +36,11 @@ import org.apache.commons.logging.LogFactory; import org.maxkey.authz.oauth2.common.OAuth2AccessToken; import org.maxkey.authz.oauth2.common.OAuth2Constants; import org.maxkey.authz.oauth2.common.exceptions.InvalidTokenException; -import org.maxkey.authz.oauth2.common.exceptions.OAuth2Exception; import org.maxkey.authz.oauth2.provider.OAuth2Authentication; import org.maxkey.authz.oauth2.provider.token.AccessTokenConverter; import org.maxkey.authz.oauth2.provider.token.DefaultAccessTokenConverter; import org.maxkey.authz.oauth2.provider.token.ResourceServerTokenServices; -import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; diff --git a/maxkey-protocols/maxkey-protocol-oauth-2.0/src/main/java/org/maxkey/authz/oauth2/provider/token/RemoteTokenServices.java b/maxkey-protocols/maxkey-protocol-oauth-2.0/src/main/java/org/maxkey/authz/oauth2/provider/token/RemoteTokenServices.java index 0368b0112..dc5d10366 100644 --- a/maxkey-protocols/maxkey-protocol-oauth-2.0/src/main/java/org/maxkey/authz/oauth2/provider/token/RemoteTokenServices.java +++ b/maxkey-protocols/maxkey-protocol-oauth-2.0/src/main/java/org/maxkey/authz/oauth2/provider/token/RemoteTokenServices.java @@ -31,6 +31,7 @@ package org.maxkey.authz.oauth2.provider.token; import java.io.IOException; import java.io.UnsupportedEncodingException; +import java.util.Base64; import java.util.Map; import org.apache.commons.logging.Log; @@ -44,7 +45,6 @@ import org.springframework.http.HttpMethod; import org.springframework.http.MediaType; import org.springframework.http.client.ClientHttpResponse; import org.springframework.security.core.AuthenticationException; -import org.springframework.security.crypto.codec.Base64; import org.springframework.util.Assert; import org.springframework.util.LinkedMultiValueMap; import org.springframework.util.MultiValueMap; @@ -134,7 +134,7 @@ public class RemoteTokenServices implements ResourceServerTokenServices { private String getAuthorizationHeader(String clientId, String clientSecret) { String creds = String.format("%s:%s", clientId, clientSecret); try { - return "Basic " + new String(Base64.encode(creds.getBytes("UTF-8"))); + return "Basic " + new String(Base64.getEncoder().encodeToString(creds.getBytes("UTF-8"))); } catch (UnsupportedEncodingException e) { throw new IllegalStateException("Could not convert String"); diff --git a/maxkey-protocols/maxkey-protocol-oauth-2.0/src/main/java/org/maxkey/authz/oauth2/provider/token/store/JwtAccessTokenConverter.java b/maxkey-protocols/maxkey-protocol-oauth-2.0/src/main/java/org/maxkey/authz/oauth2/provider/token/store/JwtAccessTokenConverter.java index d692e662a..373c67801 100644 --- a/maxkey-protocols/maxkey-protocol-oauth-2.0/src/main/java/org/maxkey/authz/oauth2/provider/token/store/JwtAccessTokenConverter.java +++ b/maxkey-protocols/maxkey-protocol-oauth-2.0/src/main/java/org/maxkey/authz/oauth2/provider/token/store/JwtAccessTokenConverter.java @@ -33,6 +33,7 @@ import java.security.KeyPair; import java.security.PrivateKey; import java.security.interfaces.RSAPrivateKey; import java.security.interfaces.RSAPublicKey; +import java.util.Base64; import java.util.Date; import java.util.LinkedHashMap; import java.util.Map; @@ -62,7 +63,6 @@ import org.maxkey.authz.oauth2.provider.token.AccessTokenConverter; import org.maxkey.authz.oauth2.provider.token.DefaultAccessTokenConverter; import org.maxkey.authz.oauth2.provider.token.TokenEnhancer; import org.springframework.beans.factory.InitializingBean; -import org.springframework.security.crypto.codec.Base64; import org.springframework.util.Assert; /** @@ -144,7 +144,7 @@ public class JwtAccessTokenConverter implements TokenEnhancer, AccessTokenConver signer = new RsaSigner((RSAPrivateKey) privateKey); RSAPublicKey publicKey = (RSAPublicKey) keyPair.getPublic(); verifier = new RsaVerifier(publicKey); - verifierKey = "-----BEGIN PUBLIC KEY-----\n" + new String(Base64.encode(publicKey.getEncoded())) + verifierKey = "-----BEGIN PUBLIC KEY-----\n" + new String(Base64.getMimeEncoder().encodeToString(publicKey.getEncoded())) + "\n-----END PUBLIC KEY-----"; } @@ -155,7 +155,7 @@ public class JwtAccessTokenConverter implements TokenEnhancer, AccessTokenConver * @param key the key to be used for signing JWTs. */ public void setSigningKey(String key) { - Assert.hasText(key); + Assert.hasText(key,"key must not be empty"); key = key.trim(); this.signingKey = key; diff --git a/maxkey-protocols/maxkey-protocol-oauth-2.0/src/main/java/org/maxkey/authz/oauth2/provider/token/store/RedisTokenStore.java b/maxkey-protocols/maxkey-protocol-oauth-2.0/src/main/java/org/maxkey/authz/oauth2/provider/token/store/RedisTokenStore.java index 414a1a789..0cfa2ba42 100644 --- a/maxkey-protocols/maxkey-protocol-oauth-2.0/src/main/java/org/maxkey/authz/oauth2/provider/token/store/RedisTokenStore.java +++ b/maxkey-protocols/maxkey-protocol-oauth-2.0/src/main/java/org/maxkey/authz/oauth2/provider/token/store/RedisTokenStore.java @@ -43,20 +43,22 @@ import java.util.Date; public class RedisTokenStore implements TokenStore { static final Logger _logger = LoggerFactory.getLogger(RedisTokenStore.class); - private static final String ACCESS = "REDIS_OAUTH_V20_ACCESS_"; - private static final String AUTH_TO_ACCESS = "REDIS_OAUTH_V20_AUTH_TO_ACCESS_"; - private static final String AUTH = "REDIS_OAUTH_V20_AUTH_"; - private static final String REFRESH_AUTH = "REDIS_OAUTH_V20_REFRESH_AUTH_"; - private static final String ACCESS_TO_REFRESH = "REDIS_OAUTH_V20_ACCESS_TO_REFRESH_"; - private static final String REFRESH = "REDIS_OAUTH_V20_REFRESH_"; - private static final String REFRESH_TO_ACCESS = "REDIS_OAUTH_V20_REFRESH_TO_ACCESS_"; - private static final String CLIENT_ID_TO_ACCESS = "REDIS_OAUTH_V20_CLIENT_ID_TO_ACCESS_"; - private static final String UNAME_TO_ACCESS = "REDIS_OAUTH_V20_UNAME_TO_ACCESS_"; + private static final String PREFIX = "REDIS_OAUTH_V20_"; + + private static final String ACCESS = PREFIX + "ACCESS_"; + private static final String AUTH_TO_ACCESS = PREFIX + "AUTH_TO_ACCESS_"; + private static final String AUTH = PREFIX + "AUTH_"; + private static final String REFRESH_AUTH = PREFIX + "REFRESH_AUTH_"; + private static final String ACCESS_TO_REFRESH = PREFIX + "ACCESS_TO_REFRESH_"; + private static final String REFRESH = PREFIX + "REFRESH_"; + private static final String REFRESH_TO_ACCESS = PREFIX + "REFRESH_TO_ACCESS_"; + private static final String CLIENT_ID_TO_ACCESS = PREFIX + "CLIENT_ID_TO_ACCESS_"; + private static final String UNAME_TO_ACCESS = PREFIX + "UNAME_TO_ACCESS_"; private final RedisConnectionFactory connectionFactory; private AuthenticationKeyGenerator authenticationKeyGenerator = new DefaultAuthenticationKeyGenerator(); - private String prefix = ""; + public RedisTokenStore(RedisConnectionFactory connectionFactory) { this.connectionFactory = connectionFactory; @@ -66,11 +68,6 @@ public class RedisTokenStore implements TokenStore { this.authenticationKeyGenerator = authenticationKeyGenerator; } - - public void setPrefix(String prefix) { - this.prefix = prefix; - } - private RedisConnection getConnection() { return connectionFactory.getConnection(); } diff --git a/maxkey-protocols/maxkey-protocol-oauth-2.0/src/main/java/org/maxkey/authz/oidc/idtoken/OIDCIdTokenEnhancer.java b/maxkey-protocols/maxkey-protocol-oauth-2.0/src/main/java/org/maxkey/authz/oidc/idtoken/OIDCIdTokenEnhancer.java index 3401d6193..2835149b6 100644 --- a/maxkey-protocols/maxkey-protocol-oauth-2.0/src/main/java/org/maxkey/authz/oidc/idtoken/OIDCIdTokenEnhancer.java +++ b/maxkey-protocols/maxkey-protocol-oauth-2.0/src/main/java/org/maxkey/authz/oidc/idtoken/OIDCIdTokenEnhancer.java @@ -47,6 +47,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.google.common.base.Strings; +import com.nimbusds.jose.Algorithm; import com.nimbusds.jose.EncryptionMethod; import com.nimbusds.jose.JWEAlgorithm; import com.nimbusds.jose.JWEHeader; @@ -164,7 +165,7 @@ public class OIDCIdTokenEnhancer implements TokenEnhancer { logger.error("Couldn't create Jwt Encryption Service"); } } else { - if (signingAlg==null||signingAlg.equals("none")) { + if (signingAlg==null||signingAlg.equals(Algorithm.NONE)) { // unsigned ID token idToken = new PlainJWT(builder.build()); } else { diff --git a/maxkey-protocols/maxkey-protocol-oauth-2.0/src/main/java/org/maxkey/autoconfigure/Oauth20AutoConfiguration.java b/maxkey-protocols/maxkey-protocol-oauth-2.0/src/main/java/org/maxkey/autoconfigure/Oauth20AutoConfiguration.java index ddcbdc4e5..007452497 100644 --- a/maxkey-protocols/maxkey-protocol-oauth-2.0/src/main/java/org/maxkey/autoconfigure/Oauth20AutoConfiguration.java +++ b/maxkey-protocols/maxkey-protocol-oauth-2.0/src/main/java/org/maxkey/autoconfigure/Oauth20AutoConfiguration.java @@ -150,7 +150,7 @@ public class Oauth20AutoConfiguration implements InitializingBean { throws NoSuchAlgorithmException, InvalidKeySpecException, JOSEException { DefaultJwtEncryptionAndDecryptionService jwtEncryptionService = new DefaultJwtEncryptionAndDecryptionService(jwtSetKeyStore); - jwtEncryptionService.setDefaultAlgorithm(JWEAlgorithm.RSA1_5);//RSA1_5 + jwtEncryptionService.setDefaultAlgorithm(JWEAlgorithm.RSA_OAEP_256);//RSA1_5 jwtEncryptionService.setDefaultDecryptionKeyId("maxkey_rsa"); jwtEncryptionService.setDefaultEncryptionKeyId("maxkey_rsa"); return jwtEncryptionService; diff --git a/maxkey-protocols/maxkey-protocol-oauth-2.0/src/main/resources/META-INF/MANIFEST.MF b/maxkey-protocols/maxkey-protocol-oauth-2.0/src/main/resources/META-INF/MANIFEST.MF deleted file mode 100644 index 254272e1c..000000000 --- a/maxkey-protocols/maxkey-protocol-oauth-2.0/src/main/resources/META-INF/MANIFEST.MF +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -Class-Path: - diff --git a/maxkey-protocols/maxkey-protocol-saml-2.0/src/main/java/org/maxkey/authz/saml20/consumer/endpoint/ConsumerEndpoint.java b/maxkey-protocols/maxkey-protocol-saml-2.0/src/main/java/org/maxkey/authz/saml20/consumer/endpoint/ConsumerEndpoint.java index 066a8f413..556ddcc7c 100644 --- a/maxkey-protocols/maxkey-protocol-saml-2.0/src/main/java/org/maxkey/authz/saml20/consumer/endpoint/ConsumerEndpoint.java +++ b/maxkey-protocols/maxkey-protocol-saml-2.0/src/main/java/org/maxkey/authz/saml20/consumer/endpoint/ConsumerEndpoint.java @@ -35,6 +35,7 @@ import org.maxkey.authz.saml.common.EndpointGenerator; import org.maxkey.authz.saml.common.TrustResolver; import org.maxkey.authz.saml.service.IDService; import org.maxkey.authz.saml.service.TimeService; +import org.maxkey.authz.saml20.binding.BindingAdapter; import org.maxkey.authz.saml20.binding.ExtractBindingAdapter; import org.maxkey.authz.saml20.consumer.AuthnRequestGenerator; import org.maxkey.authz.saml20.consumer.spring.IdentityProviderAuthenticationException; @@ -51,6 +52,7 @@ import org.opensaml.common.binding.security.MessageReplayRule; import org.opensaml.saml2.core.Assertion; import org.opensaml.saml2.core.Response; import org.opensaml.saml2.core.StatusCode; +import org.opensaml.ws.message.decoder.MessageDecodingException; import org.opensaml.xml.security.CriteriaSet; import org.opensaml.xml.security.SecurityException; import org.opensaml.xml.security.credential.Credential; @@ -77,6 +79,8 @@ public class ConsumerEndpoint { private final static Logger logger = LoggerFactory.getLogger(ConsumerEndpoint.class); + private BindingAdapter bindingAdapter; + @Autowired @Qualifier("spKeyStoreLoader") private KeyStoreLoader keyStoreLoader; @@ -129,8 +133,8 @@ public class ConsumerEndpoint { initCredential(spId); SAMLMessageContext messageContext=null; - - /*try { + /* + try { messageContext = bindingAdapter.extractSAMLMessageContext(request); } catch (MessageDecodingException me) { logger.error("Could not decode SAML Response", me); diff --git a/maxkey-protocols/maxkey-protocol-saml-2.0/src/main/java/org/maxkey/authz/saml20/jit/ProvisioningAdapter.java b/maxkey-protocols/maxkey-protocol-saml-2.0/src/main/java/org/maxkey/authz/saml20/jit/ProvisioningAdapter.java index a49d027e1..7149533be 100644 --- a/maxkey-protocols/maxkey-protocol-saml-2.0/src/main/java/org/maxkey/authz/saml20/jit/ProvisioningAdapter.java +++ b/maxkey-protocols/maxkey-protocol-saml-2.0/src/main/java/org/maxkey/authz/saml20/jit/ProvisioningAdapter.java @@ -18,12 +18,6 @@ package org.maxkey.authz.saml20.jit; -import java.util.HashMap; -import java.util.List; - -import org.maxkey.entity.UserInfo; - - public interface ProvisioningAdapter { //HashMap construct(UserInfo userInfo,Companys company,List listRoles) ; diff --git a/maxkey-protocols/maxkey-protocol-saml-2.0/src/main/java/org/maxkey/authz/saml20/xml/SAML2ValidatorSuite.java b/maxkey-protocols/maxkey-protocol-saml-2.0/src/main/java/org/maxkey/authz/saml20/xml/SAML2ValidatorSuite.java index e015b4aba..03a515f16 100644 --- a/maxkey-protocols/maxkey-protocol-saml-2.0/src/main/java/org/maxkey/authz/saml20/xml/SAML2ValidatorSuite.java +++ b/maxkey-protocols/maxkey-protocol-saml-2.0/src/main/java/org/maxkey/authz/saml20/xml/SAML2ValidatorSuite.java @@ -21,7 +21,6 @@ import org.opensaml.xml.Configuration; import org.opensaml.xml.XMLObject; import org.opensaml.xml.validation.ValidationException; import org.opensaml.xml.validation.ValidatorSuite; -import org.springframework.beans.factory.InitializingBean; public class SAML2ValidatorSuite { diff --git a/maxkey-protocols/maxkey-protocol-saml-2.0/src/main/java/org/maxkey/autoconfigure/Saml20AutoConfiguration.java b/maxkey-protocols/maxkey-protocol-saml-2.0/src/main/java/org/maxkey/autoconfigure/Saml20AutoConfiguration.java index 2865837d7..2ffe25727 100644 --- a/maxkey-protocols/maxkey-protocol-saml-2.0/src/main/java/org/maxkey/autoconfigure/Saml20AutoConfiguration.java +++ b/maxkey-protocols/maxkey-protocol-saml-2.0/src/main/java/org/maxkey/autoconfigure/Saml20AutoConfiguration.java @@ -107,6 +107,7 @@ public class Saml20AutoConfiguration implements InitializingBean { @Bean(name = "authnResponseGenerator") public AuthnResponseGenerator authnResponseGenerator(TimeService timeService,IDService idService, @Value("${maxkey.saml.v20.idp.issuer}") String issuerEntityName) { + _logger.debug("issuerEntityName " + issuerEntityName); AuthnResponseGenerator generator = new AuthnResponseGenerator(issuerEntityName,timeService,idService); return generator; } @@ -163,6 +164,7 @@ public class Saml20AutoConfiguration implements InitializingBean { * MapBasedStorageService. * @return mapBasedStorageService */ + @SuppressWarnings("rawtypes") @Bean(name = "mapBasedStorageService") public MapBasedStorageService mapBasedStorageService() { MapBasedStorageService mapBasedStorageService = new MapBasedStorageService(); @@ -175,6 +177,7 @@ public class Saml20AutoConfiguration implements InitializingBean { * @throws IOException * @throws VelocityException */ + @SuppressWarnings({ "deprecation"}) @Bean(name = "velocityEngine") public VelocityEngine velocityEngine() throws VelocityException, IOException { VelocityEngineFactoryBean factory = new VelocityEngineFactoryBean(); diff --git a/maxkey-webs/maxkey-boot-monitor/src/main/resources/application.properties b/maxkey-webs/maxkey-boot-monitor/src/main/resources/application.properties index aec38ce19..9cc9f93f6 100644 --- a/maxkey-webs/maxkey-boot-monitor/src/main/resources/application.properties +++ b/maxkey-webs/maxkey-boot-monitor/src/main/resources/application.properties @@ -18,7 +18,7 @@ application.title =MaxKey #for dynamic service discovery spring.application.name =maxkey-monitor -application.formatted-version =v2.9.0 GA +application.formatted-version =v3.0.0 GA #nacos spring.cloud.nacos.discovery.enabled =${NACOS_DISCOVERY_ENABLED:false} spring.cloud.nacos.discovery.instance-enabled =false diff --git a/maxkey-webs/maxkey-web-maxkey/src/main/java/org/maxkey/web/filter/SingleSignOnFilter.java b/maxkey-webs/maxkey-web-maxkey/src/main/java/org/maxkey/web/filter/SingleSignOnFilter.java index 36a70f3f7..3736d1ef4 100644 --- a/maxkey-webs/maxkey-web-maxkey/src/main/java/org/maxkey/web/filter/SingleSignOnFilter.java +++ b/maxkey-webs/maxkey-web-maxkey/src/main/java/org/maxkey/web/filter/SingleSignOnFilter.java @@ -25,7 +25,6 @@ import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import org.maxkey.util.StringUtils; import org.maxkey.web.WebConstants; @@ -47,7 +46,6 @@ public class SingleSignOnFilter implements Filter { ServletResponse response, FilterChain chain)throws IOException, ServletException { HttpServletRequest httpServletRequest = (HttpServletRequest) request; - HttpServletResponse httpServletResponse = (HttpServletResponse) response; HttpSession session = httpServletRequest.getSession(); // 浠巗ession涓幏鍙栧瓨鏀剧殑appid String appId = (String) session.getAttribute(WebConstants.SINGLE_SIGN_ON_APP_ID); diff --git a/maxkey-webs/maxkey-web-maxkey/src/main/java/org/maxkey/web/historys/contorller/HistoryLoginController.java b/maxkey-webs/maxkey-web-maxkey/src/main/java/org/maxkey/web/historys/contorller/HistoryLoginController.java index b1895b6ca..aa2a47c9d 100644 --- a/maxkey-webs/maxkey-web-maxkey/src/main/java/org/maxkey/web/historys/contorller/HistoryLoginController.java +++ b/maxkey-webs/maxkey-web-maxkey/src/main/java/org/maxkey/web/historys/contorller/HistoryLoginController.java @@ -21,11 +21,7 @@ import java.text.SimpleDateFormat; import java.util.Date; import org.apache.mybatis.jpa.persistence.JpaPageResults; import org.maxkey.entity.HistoryLogin; -import org.maxkey.entity.HistoryLoginApps; -import org.maxkey.entity.HistoryLogs; -import org.maxkey.persistence.service.HistoryLoginAppsService; import org.maxkey.persistence.service.HistoryLoginService; -import org.maxkey.persistence.service.HistorySystemLogsService; import org.maxkey.util.DateUtils; import org.maxkey.web.WebContext; import org.slf4j.Logger; diff --git a/maxkey-webs/maxkey-web-maxkey/src/main/java/org/maxkey/web/interceptor/HistoryLoginAppAdapter.java b/maxkey-webs/maxkey-web-maxkey/src/main/java/org/maxkey/web/interceptor/HistoryLoginAppAdapter.java index 0a6771c76..190b1eb0c 100644 --- a/maxkey-webs/maxkey-web-maxkey/src/main/java/org/maxkey/web/interceptor/HistoryLoginAppAdapter.java +++ b/maxkey-webs/maxkey-web-maxkey/src/main/java/org/maxkey/web/interceptor/HistoryLoginAppAdapter.java @@ -21,7 +21,6 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.maxkey.authn.SigninPrincipal; -import org.maxkey.authz.endpoint.AuthorizeBaseEndpoint; import org.maxkey.entity.HistoryLoginApps; import org.maxkey.entity.UserInfo; import org.maxkey.entity.apps.Apps; diff --git a/maxkey-webs/maxkey-web-maxkey/src/main/java/org/maxkey/web/interceptor/PreLoginAppAdapter.java b/maxkey-webs/maxkey-web-maxkey/src/main/java/org/maxkey/web/interceptor/PreLoginAppAdapter.java index 03c0fe72e..e2368ef96 100644 --- a/maxkey-webs/maxkey-web-maxkey/src/main/java/org/maxkey/web/interceptor/PreLoginAppAdapter.java +++ b/maxkey-webs/maxkey-web-maxkey/src/main/java/org/maxkey/web/interceptor/PreLoginAppAdapter.java @@ -20,7 +20,6 @@ package org.maxkey.web.interceptor; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.maxkey.entity.UserInfo; import org.maxkey.web.WebConstants; import org.maxkey.web.WebContext; import org.slf4j.Logger; @@ -38,7 +37,6 @@ public class PreLoginAppAdapter implements AsyncHandlerInterceptor { HttpServletResponse response, Object handler) throws Exception { _logger.debug("preHandle"); - UserInfo userInfo = WebContext.getUserInfo(); String redirect_uri = request.getRequestURL().toString(); String appId = getAppIdFromRequestUrl(request); _logger.debug("preHandle app Id " + appId); @@ -47,6 +45,7 @@ public class PreLoginAppAdapter implements AsyncHandlerInterceptor { return true; } /* + * UserInfo userInfo = WebContext.getUserInfo(); * if(userInfo.getProtectedAppsMap().get(appId)!=null){ * * request.setAttribute("redirect_uri",redirect_uri); diff --git a/maxkey-webs/maxkey-web-maxkey/src/main/resources/application.properties b/maxkey-webs/maxkey-web-maxkey/src/main/resources/application.properties index 84d53748a..1920eece0 100644 --- a/maxkey-webs/maxkey-web-maxkey/src/main/resources/application.properties +++ b/maxkey-webs/maxkey-web-maxkey/src/main/resources/application.properties @@ -16,7 +16,7 @@ #MaxKey Title and Version # ############################################################################ application.title =MaxKey -application.formatted-version =v2.9.0 GA +application.formatted-version =v3.0.0 GA #for dynamic service discovery spring.application.name =maxkey ############################################################################ diff --git a/maxkey-webs/maxkey-web-maxkey/src/main/resources/templates/views/index.ftl b/maxkey-webs/maxkey-web-maxkey/src/main/resources/templates/views/index.ftl index 96ef514ed..28d963ce8 100644 --- a/maxkey-webs/maxkey-web-maxkey/src/main/resources/templates/views/index.ftl +++ b/maxkey-webs/maxkey-web-maxkey/src/main/resources/templates/views/index.ftl @@ -2,7 +2,7 @@ - MaxKey + <@locale code="global.title"/> " /> diff --git a/maxkey-webs/maxkey-web-mgt/src/main/java/org/maxkey/jobs/DynamicGroupsJob.java b/maxkey-webs/maxkey-web-mgt/src/main/java/org/maxkey/jobs/DynamicGroupsJob.java index 973a33249..887e95c2c 100644 --- a/maxkey-webs/maxkey-web-mgt/src/main/java/org/maxkey/jobs/DynamicGroupsJob.java +++ b/maxkey-webs/maxkey-web-mgt/src/main/java/org/maxkey/jobs/DynamicGroupsJob.java @@ -27,8 +27,6 @@ import org.quartz.JobExecutionContext; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import com.fasterxml.jackson.annotation.JsonIgnore; - public class DynamicGroupsJob implements Job , Serializable { /** * diff --git a/maxkey-webs/maxkey-web-mgt/src/main/java/org/maxkey/web/api/endpoint/RestTimeBasedOtpController.java b/maxkey-webs/maxkey-web-mgt/src/main/java/org/maxkey/web/api/endpoint/RestTimeBasedOtpController.java index fbf5bd78a..bd3bdf602 100644 --- a/maxkey-webs/maxkey-web-mgt/src/main/java/org/maxkey/web/api/endpoint/RestTimeBasedOtpController.java +++ b/maxkey-webs/maxkey-web-mgt/src/main/java/org/maxkey/web/api/endpoint/RestTimeBasedOtpController.java @@ -17,7 +17,6 @@ package org.maxkey.web.api.endpoint; -import org.maxkey.crypto.password.PasswordReciprocal; import org.maxkey.entity.UserInfo; import org.maxkey.password.onetimepwd.AbstractOtpAuthn; import org.maxkey.persistence.service.UserInfoService; diff --git a/maxkey-webs/maxkey-web-mgt/src/main/java/org/maxkey/web/apps/contorller/BasicDetailsController.java b/maxkey-webs/maxkey-web-mgt/src/main/java/org/maxkey/web/apps/contorller/BasicDetailsController.java index 74e574d30..615468233 100644 --- a/maxkey-webs/maxkey-web-mgt/src/main/java/org/maxkey/web/apps/contorller/BasicDetailsController.java +++ b/maxkey-webs/maxkey-web-mgt/src/main/java/org/maxkey/web/apps/contorller/BasicDetailsController.java @@ -17,8 +17,6 @@ package org.maxkey.web.apps.contorller; -import java.util.List; - import org.maxkey.constants.ConstantsOperateMessage; import org.maxkey.constants.ConstantsProtocols; import org.maxkey.crypto.ReciprocalUtils; diff --git a/maxkey-webs/maxkey-web-mgt/src/main/java/org/maxkey/web/apps/contorller/ExtendApiDetailsController.java b/maxkey-webs/maxkey-web-mgt/src/main/java/org/maxkey/web/apps/contorller/ExtendApiDetailsController.java index d8cf57a05..0a5733813 100644 --- a/maxkey-webs/maxkey-web-mgt/src/main/java/org/maxkey/web/apps/contorller/ExtendApiDetailsController.java +++ b/maxkey-webs/maxkey-web-mgt/src/main/java/org/maxkey/web/apps/contorller/ExtendApiDetailsController.java @@ -17,8 +17,6 @@ package org.maxkey.web.apps.contorller; -import java.util.List; - import org.maxkey.constants.ConstantsOperateMessage; import org.maxkey.constants.ConstantsProtocols; import org.maxkey.crypto.ReciprocalUtils; diff --git a/maxkey-webs/maxkey-web-mgt/src/main/java/org/maxkey/web/apps/contorller/FormBasedDetailsController.java b/maxkey-webs/maxkey-web-mgt/src/main/java/org/maxkey/web/apps/contorller/FormBasedDetailsController.java index 925835596..796c9b535 100644 --- a/maxkey-webs/maxkey-web-mgt/src/main/java/org/maxkey/web/apps/contorller/FormBasedDetailsController.java +++ b/maxkey-webs/maxkey-web-mgt/src/main/java/org/maxkey/web/apps/contorller/FormBasedDetailsController.java @@ -17,8 +17,6 @@ package org.maxkey.web.apps.contorller; -import java.util.List; - import org.maxkey.constants.ConstantsOperateMessage; import org.maxkey.constants.ConstantsProtocols; import org.maxkey.crypto.ReciprocalUtils; diff --git a/maxkey-webs/maxkey-web-mgt/src/main/java/org/maxkey/web/apps/contorller/OAuth20DetailsController.java b/maxkey-webs/maxkey-web-mgt/src/main/java/org/maxkey/web/apps/contorller/OAuth20DetailsController.java index 881274377..8763aa13a 100644 --- a/maxkey-webs/maxkey-web-mgt/src/main/java/org/maxkey/web/apps/contorller/OAuth20DetailsController.java +++ b/maxkey-webs/maxkey-web-mgt/src/main/java/org/maxkey/web/apps/contorller/OAuth20DetailsController.java @@ -17,8 +17,6 @@ package org.maxkey.web.apps.contorller; -import java.util.List; - import org.maxkey.authz.oauth2.provider.client.JdbcClientDetailsService; import org.maxkey.constants.ConstantsOperateMessage; import org.maxkey.constants.ConstantsProtocols; diff --git a/maxkey-webs/maxkey-web-mgt/src/main/java/org/maxkey/web/apps/contorller/SAML20DetailsController.java b/maxkey-webs/maxkey-web-mgt/src/main/java/org/maxkey/web/apps/contorller/SAML20DetailsController.java index 8de85d5ba..e90bd0e75 100644 --- a/maxkey-webs/maxkey-web-mgt/src/main/java/org/maxkey/web/apps/contorller/SAML20DetailsController.java +++ b/maxkey-webs/maxkey-web-mgt/src/main/java/org/maxkey/web/apps/contorller/SAML20DetailsController.java @@ -30,7 +30,6 @@ import org.maxkey.configuration.ApplicationConfig; import org.maxkey.constants.ConstantsOperateMessage; import org.maxkey.constants.ConstantsProtocols; import org.maxkey.crypto.ReciprocalUtils; -import org.maxkey.crypto.cert.NameUtil; import org.maxkey.crypto.cert.X509CertUtils; import org.maxkey.crypto.keystore.KeyStoreLoader; import org.maxkey.crypto.keystore.KeyStoreUtil; @@ -182,7 +181,7 @@ public class SAML20DetailsController extends BaseAppContorller { samlDetails.setCertSubject(samlDetails.getTrustCert().getSubjectDN().getName()); samlDetails.setCertExpiration(samlDetails.getTrustCert().getNotAfter().toString()); - samlDetails.setCertIssuer(NameUtil.getCommonName(samlDetails.getTrustCert().getIssuerX500Principal())); + samlDetails.setCertIssuer(X509CertUtils.getCommonName(samlDetails.getTrustCert().getIssuerX500Principal())); KeyStore keyStore = KeyStoreUtil.clone(idpKeyStoreLoader.getKeyStore(),idpKeyStoreLoader.getKeystorePassword()); diff --git a/maxkey-webs/maxkey-web-mgt/src/main/java/org/maxkey/web/contorller/GroupMemberController.java b/maxkey-webs/maxkey-web-mgt/src/main/java/org/maxkey/web/contorller/GroupMemberController.java index 78dc64ee3..bda1221e9 100644 --- a/maxkey-webs/maxkey-web-mgt/src/main/java/org/maxkey/web/contorller/GroupMemberController.java +++ b/maxkey-webs/maxkey-web-mgt/src/main/java/org/maxkey/web/contorller/GroupMemberController.java @@ -21,7 +21,6 @@ import org.apache.mybatis.jpa.persistence.JpaPageResults; import org.maxkey.constants.ConstantsOperateMessage; import org.maxkey.entity.GroupMember; import org.maxkey.entity.Groups; -import org.maxkey.entity.UserInfo; import org.maxkey.persistence.service.GroupMemberService; import org.maxkey.persistence.service.GroupsService; import org.maxkey.web.WebContext; diff --git a/maxkey-webs/maxkey-web-mgt/src/main/resources/application.properties b/maxkey-webs/maxkey-web-mgt/src/main/resources/application.properties index 560c8458d..1d9da5062 100644 --- a/maxkey-webs/maxkey-web-mgt/src/main/resources/application.properties +++ b/maxkey-webs/maxkey-web-mgt/src/main/resources/application.properties @@ -16,7 +16,7 @@ #MaxKey Title and Version # ############################################################################ application.title =MaxKey-Mgt -application.formatted-version =v2.9.0 GA +application.formatted-version =v3.0.0 GA #for dynamic service discovery spring.application.name =maxkey-mgt ############################################################################ diff --git a/maxkey-webs/maxkey-web-mgt/src/main/resources/templates/views/index.ftl b/maxkey-webs/maxkey-web-mgt/src/main/resources/templates/views/index.ftl index 2e315c533..05f7233f7 100644 --- a/maxkey-webs/maxkey-web-mgt/src/main/resources/templates/views/index.ftl +++ b/maxkey-webs/maxkey-web-mgt/src/main/resources/templates/views/index.ftl @@ -2,7 +2,7 @@ - MaxKey + <@locale code="global.title"/> " /> diff --git a/maxkey-webs/maxkey-web-resources/src/main/resources/static/css_mgt/base.css b/maxkey-webs/maxkey-web-resources/src/main/resources/static/css_mgt/base.css index cbe22a775..47542a78f 100644 --- a/maxkey-webs/maxkey-web-resources/src/main/resources/static/css_mgt/base.css +++ b/maxkey-webs/maxkey-web-resources/src/main/resources/static/css_mgt/base.css @@ -90,11 +90,10 @@ header .header-container .nav-left>li, .header .header-container .nav-right>li { } .sidenav-fold-toggler{ - + text-align: inherit; } [class^=lni-], [class*=" lni-"] { font-family: lineicons!important; - speak: none; font-style: normal; font-weight: 400; font-variant: normal; @@ -251,7 +250,7 @@ header .header-container .nav-left>li, .header .header-container .nav-right>li { text-shadow: 0 1px 0 #fff; border-bottom: 1px solid #e5e5e5; min-width: 100%; - align:left; + text-align:left; height:60px; margin-bottom: 1px; } @@ -272,6 +271,7 @@ header .header-container .nav-left>li, .header .header-container .nav-right>li { } #nav_third{ /*border-top: 1px solid #e5e5e5;*/ + text-align: inherit; } #mainFrame{ @@ -280,7 +280,7 @@ header .header-container .nav-left>li, .header .header-container .nav-right>li { margin-right: auto; display: block; width:990px; - align:center; + text-align:center } #footer{ @@ -465,14 +465,13 @@ header .header-container .nav-left>li, .header .header-container .nav-right>li { .switch_tab{ list-style: none; border: 0; - cellspacing:0; + border-collapse:collapse } .switch_tab_class{ float:left; height:36px; text-align: center; - display: inline-block; } .switch_tab_class a{ @@ -496,7 +495,7 @@ header .header-container .nav-left>li, .header .header-container .nav-right>li { #tableform{ border: 1px solid #e9eeed; - cellspacing:0; + border-collapse:collapse } .login_form_table{ diff --git a/settings.gradle b/settings.gradle index 7de5d8ad9..521d04e98 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,48 +1,61 @@ /* - * in the user guide at https://docs.gradle.org + * Copyright [2021] [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. */ + +/* + * project name and include subprojects + */ + rootProject.name = 'MaxKey' +include ( //Common -include 'maxkey-common' -include 'maxkey-core' -include 'maxkey-persistence' - -//include 'maxkey-authentications' -include 'maxkey-authentications:maxkey-authentication-core' -include 'maxkey-authentications:maxkey-authentication-captcha' -include 'maxkey-authentications:maxkey-authentication-social' -include 'maxkey-authentications:maxkey-authentication-otp' - +'maxkey-common', +'maxkey-core', +'maxkey-persistence', +//authentications +'maxkey-authentications:maxkey-authentication-core', +'maxkey-authentications:maxkey-authentication-captcha', +'maxkey-authentications:maxkey-authentication-social', +'maxkey-authentications:maxkey-authentication-otp', //identity -include 'maxkey-identitys:maxkey-identity-scim' -include 'maxkey-identitys:maxkey-identity-rest' -include 'maxkey-identitys:maxkey-synchronizers' -include 'maxkey-identitys:maxkey-synchronizers-activedirectory' -include 'maxkey-identitys:maxkey-synchronizers-ldap' -include 'maxkey-identitys:maxkey-synchronizers-dingding' -include 'maxkey-identitys:maxkey-synchronizers-workweixin' - +'maxkey-identitys:maxkey-identity-scim', +'maxkey-identitys:maxkey-identity-rest', +'maxkey-identitys:maxkey-synchronizers', +'maxkey-identitys:maxkey-synchronizers-activedirectory', +'maxkey-identitys:maxkey-synchronizers-ldap', +'maxkey-identitys:maxkey-synchronizers-dingding', +'maxkey-identitys:maxkey-synchronizers-workweixin', //Protocol -//include 'maxkey-protocols' -include 'maxkey-protocols:maxkey-protocol-authorize' -include 'maxkey-protocols:maxkey-protocol-oauth-2.0' -include 'maxkey-protocols:maxkey-protocol-saml-2.0' -include 'maxkey-protocols:maxkey-protocol-cas' -include 'maxkey-protocols:maxkey-protocol-jwt' -include 'maxkey-protocols:maxkey-protocol-formbased' -include 'maxkey-protocols:maxkey-protocol-tokenbased' -include 'maxkey-protocols:maxkey-protocol-extendapi' - - -//include 'maxkey-webs' +'maxkey-protocols:maxkey-protocol-authorize', +'maxkey-protocols:maxkey-protocol-oauth-2.0', +'maxkey-protocols:maxkey-protocol-saml-2.0', +'maxkey-protocols:maxkey-protocol-cas', +'maxkey-protocols:maxkey-protocol-jwt', +'maxkey-protocols:maxkey-protocol-formbased', +'maxkey-protocols:maxkey-protocol-tokenbased', +'maxkey-protocols:maxkey-protocol-extendapi', +//webs //static -include 'maxkey-webs:maxkey-web-resources' +'maxkey-webs:maxkey-web-resources', //maxkey -include 'maxkey-webs:maxkey-web-maxkey' -//maxkey-mgt management -include 'maxkey-webs:maxkey-web-mgt' -//maxkey-boot-monitor -include 'maxkey-webs:maxkey-boot-monitor' -//maxkey-gataway -include 'maxkey-gataway' +'maxkey-webs:maxkey-web-maxkey', +//management(mgt) +'maxkey-webs:maxkey-web-mgt', +//monitor +'maxkey-webs:maxkey-boot-monitor', +//gataway +'maxkey-gataway' +) \ No newline at end of file