代码优化

This commit is contained in:
shimingxy
2025-04-14 14:27:11 +08:00
parent c88757c567
commit 7a1ae62e12
12 changed files with 6 additions and 15 deletions

View File

@@ -17,7 +17,6 @@
package org.dromara.maxkey.authn.web;
import org.apache.commons.lang3.StringUtils;
import org.dromara.maxkey.authn.jwt.AuthJwt;
import org.dromara.maxkey.authn.jwt.AuthRefreshTokenService;
import org.dromara.maxkey.authn.jwt.AuthTokenService;

View File

@@ -24,7 +24,6 @@ import org.dromara.maxkey.authn.realm.AbstractAuthenticationRealm;
import org.dromara.maxkey.authn.session.SessionManager;
import org.dromara.maxkey.configuration.ApplicationConfig;
import org.dromara.maxkey.constants.ConstsLoginType;
import org.dromara.maxkey.entity.Institutions;
import org.dromara.maxkey.entity.idm.UserInfo;
import org.dromara.maxkey.web.WebConstants;
import org.dromara.maxkey.web.WebContext;

View File

@@ -18,7 +18,6 @@
package org.dromara.maxkey.authn.provider.scancode;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.dromara.maxkey.authn.session.Session;
/**
* @description:

View File

@@ -28,9 +28,7 @@ import org.dromara.maxkey.authn.support.rememberme.JdbcRemeberMeManager;
import org.dromara.maxkey.configuration.ApplicationConfig;
import org.dromara.maxkey.password.sms.SmsOtpAuthnService;
import org.dromara.maxkey.persistence.service.CnfPasswordPolicyService;
import org.dromara.maxkey.persistence.service.LoginService;
import org.dromara.maxkey.persistence.service.PasswordPolicyValidatorService;
import org.dromara.maxkey.persistence.service.UserInfoService;
import org.dromara.maxkey.persistence.service.impl.PasswordPolicyValidatorServiceImpl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

View File

@@ -16,7 +16,6 @@ package org.dromara.maxkey.crypto.jose.keystore;
* limitations under the License.
******************************************************************************/
import com.google.common.base.Charsets;
import com.google.common.io.CharStreams;
import com.nimbusds.jose.JOSEException;
import com.nimbusds.jose.jwk.JWK;
@@ -25,6 +24,7 @@ import com.nimbusds.jose.jwk.RSAKey;
import java.io.IOException;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.security.PublicKey;
import java.text.ParseException;
import java.util.List;
@@ -77,7 +77,7 @@ public class JWKSetKeyStore {
_logger.debug("JWK location " + location.getURL());
// read in the file from disk
String s = CharStreams
.toString(new InputStreamReader(location.getInputStream(), Charsets.UTF_8));
.toString(new InputStreamReader(location.getInputStream(), StandardCharsets.UTF_8));
// parse it into a jwkSet object
jwkSet = JWKSet.parse(s);

View File

@@ -25,8 +25,6 @@ import java.util.List;
import org.dromara.maxkey.entity.idm.GroupMember;
import org.dromara.maxkey.entity.idm.Groups;
import org.dromara.maxkey.entity.idm.UserInfo;
import org.dromara.maxkey.entity.permissions.RoleMember;
import org.dromara.maxkey.entity.permissions.Roles;
import org.dromara.mybatis.jpa.IJpaMapper;
/**

View File

@@ -25,7 +25,6 @@ import java.lang.reflect.InvocationTargetException;
import org.apache.commons.beanutils.BeanUtils;
import org.apache.commons.lang3.StringUtils;
import org.dromara.maxkey.authn.SignPrincipal;
import org.dromara.maxkey.authz.cas.endpoint.adapter.CasPlainAdapter;
import org.dromara.maxkey.authz.cas.endpoint.response.ProxyServiceResponseBuilder;
import org.dromara.maxkey.authz.cas.endpoint.response.ServiceResponseBuilder;
import org.dromara.maxkey.authz.cas.endpoint.ticket.CasConstants;

View File

@@ -62,7 +62,7 @@ public final class OAuth2AccessTokenJackson2Deserializer extends StdDeserializer
// What should occur if a parameter exists twice
while (jp.nextToken() != JsonToken.END_OBJECT) {
String name = jp.getCurrentName();
String name = jp.currentName();
jp.nextToken();
if (OAuth2AccessToken.ACCESS_TOKEN.equals(name)) {
tokenValue = jp.getText();

View File

@@ -43,7 +43,7 @@ public class OAuth2ExceptionJackson1Deserializer extends JsonDeserializer<OAuth2
Map<String, Object> errorParams = new HashMap<String, Object>();
for (; t == JsonToken.FIELD_NAME; t = jp.nextToken()) {
// Must point to field name
String fieldName = jp.getCurrentName();
String fieldName = jp.currentName();
// And then the value...
t = jp.nextToken();
// Note: must handle null explicitly here; value deserializers won't

View File

@@ -48,7 +48,7 @@ public class OAuth2ExceptionJackson2Deserializer extends StdDeserializer<OAuth2E
Map<String, Object> errorParams = new HashMap<String, Object>();
for (; t == JsonToken.FIELD_NAME; t = jp.nextToken()) {
// Must point to field name
String fieldName = jp.getCurrentName();
String fieldName = jp.currentName();
// And then the value...
t = jp.nextToken();
// Note: must handle null explicitly here; value deserializers won't

View File

@@ -117,7 +117,7 @@ class JwtHeaderHelper {
String alg = null, enc = null, iv = null;
jp.nextToken();
while (jp.nextToken() != JsonToken.END_OBJECT) {
String fieldname = jp.getCurrentName();
String fieldname = jp.currentName();
jp.nextToken();
if (!JsonToken.VALUE_STRING.equals(jp.getCurrentToken())) {
throw new IllegalArgumentException("Header fields must be strings");

View File

@@ -43,7 +43,6 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.core.io.Resource;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.DelegatingPasswordEncoder;