Răsfoiți Sursa

代码优化

shimingxy 2 săptămâni în urmă
părinte
comite
243b546a9a

+ 1 - 8
maxkey-authentications/maxkey-authentication-core/src/main/java/org/dromara/maxkey/authn/session/Session.java

@@ -29,14 +29,7 @@ public class Session implements Serializable{
 	private static final long   serialVersionUID = 9008067569150338296L;
     
     public static final  int    MAX_EXPIRY_DURATION = 60 * 5; //default 5 minutes.
-    
-    public class CATEGORY{
-    	
-    	 public static final  int    SIGN = 1;
-    	 
-    	 public static final  int    MGMT = 5;
-    }
-    
+
     public String id;
     
     public LocalDateTime startTimestamp;

+ 30 - 0
maxkey-authentications/maxkey-authentication-core/src/main/java/org/dromara/maxkey/authn/session/SessionCategory.java

@@ -0,0 +1,30 @@
+/*
+ * Copyright [2025] [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.dromara.maxkey.authn.session;
+
+public class SessionCategory {
+	/**
+	 * 认证端
+	 */
+	public static final  int    SIGN = 1;
+	
+	/**
+	 * 管理端
+	 */
+	public static final  int    MGMT = 5;
+}

+ 2 - 2
maxkey-authentications/maxkey-authentication-provider-mgt/src/main/java/org/dromara/maxkey/authn/realm/AbstractAuthenticationRealm.java

@@ -22,7 +22,7 @@ import java.util.List;
 
 import org.dromara.maxkey.authn.SignPrincipal;
 import org.dromara.maxkey.authn.realm.ldap.LdapAuthenticationRealmService;
-import org.dromara.maxkey.authn.session.Session.CATEGORY;
+import org.dromara.maxkey.authn.session.SessionCategory;
 import org.dromara.maxkey.entity.history.HistoryLogin;
 import org.dromara.maxkey.entity.idm.Groups;
 import org.dromara.maxkey.entity.idm.UserInfo;
@@ -149,7 +149,7 @@ public abstract class AbstractAuthenticationRealm {
         historyLogin.setUsername(userInfo.getUsername());
         historyLogin.setDisplayName(userInfo.getDisplayName());
         historyLogin.setInstId(userInfo.getInstId());
-        historyLogin.setCategory(CATEGORY.MGMT);
+        historyLogin.setCategory(SessionCategory.MGMT);
         
         Region ipRegion =ipLocationParser.region(userInfo.getLastLoginIp());
         if(ipRegion != null) {

+ 2 - 2
maxkey-authentications/maxkey-authentication-provider/src/main/java/org/dromara/maxkey/authn/realm/AbstractAuthenticationRealm.java

@@ -22,7 +22,7 @@ import java.util.List;
 
 import org.dromara.maxkey.authn.SignPrincipal;
 import org.dromara.maxkey.authn.realm.ldap.LdapAuthenticationRealmService;
-import org.dromara.maxkey.authn.session.Session.CATEGORY;
+import org.dromara.maxkey.authn.session.SessionCategory;
 import org.dromara.maxkey.entity.history.HistoryLogin;
 import org.dromara.maxkey.entity.idm.Groups;
 import org.dromara.maxkey.entity.idm.UserInfo;
@@ -149,7 +149,7 @@ public abstract class AbstractAuthenticationRealm {
         historyLogin.setUsername(userInfo.getUsername());
         historyLogin.setDisplayName(userInfo.getDisplayName());
         historyLogin.setInstId(userInfo.getInstId());
-        historyLogin.setCategory(CATEGORY.SIGN);
+        historyLogin.setCategory(SessionCategory.SIGN);
         
         Region ipRegion =ipLocationParser.region(userInfo.getLastLoginIp());
         if(ipRegion != null) {

+ 1 - 1
maxkey-web-frontend/maxkey-web-app/src/environments/environment.ts

@@ -27,7 +27,7 @@ export const environment = {
   production: false,
   useHash: true,
   api: {
-    baseUrl: 'http://localhost:9527/sign/',
+    baseUrl: 'http://sso.maxkey.top/sign/',
     // baseUrl: '/sign/',
     refreshTokenEnabled: true,
     refreshTokenType: 're-request'

+ 2 - 2
maxkey-webs/maxkey-web-maxkey/src/main/java/org/dromara/maxkey/autoconfigure/MaxKeyConfig.java

@@ -27,7 +27,7 @@ import java.util.stream.Collectors;
 import org.dromara.maxkey.authn.listener.SessionListenerAdapter;
 import org.dromara.maxkey.authn.realm.jdbc.JdbcAuthenticationRealm;
 import org.dromara.maxkey.authn.realm.ldap.LdapAuthenticationRealmService;
-import org.dromara.maxkey.authn.session.Session.CATEGORY;
+import org.dromara.maxkey.authn.session.SessionCategory;
 import org.dromara.maxkey.authn.session.SessionManager;
 import org.dromara.maxkey.authn.support.kerberos.KerberosProxy;
 import org.dromara.maxkey.authn.support.kerberos.RemoteKerberosService;
@@ -212,7 +212,7 @@ public class MaxKeyConfig  {
 	    		.setCron("0 0/10 * * * ?")
 	    		.setJobClass(SessionListenerAdapter.class)
 	    		.setJobData("sessionManager",sessionManager)
-	    		.setJobData("category", CATEGORY.SIGN)
+	    		.setJobData("category", SessionCategory.SIGN)
 	    		.build();
 	        logger.debug("Session ListenerAdapter inited .");
     	}

+ 2 - 2
maxkey-webs/maxkey-web-mgt/src/main/java/org/dromara/maxkey/autoconfigure/MaxKeyMgtListenerConfig.java

@@ -18,7 +18,7 @@
 package org.dromara.maxkey.autoconfigure;
 
 import org.dromara.maxkey.authn.listener.SessionListenerAdapter;
-import org.dromara.maxkey.authn.session.Session.CATEGORY;
+import org.dromara.maxkey.authn.session.SessionCategory;
 import org.dromara.maxkey.authn.session.SessionManager;
 import org.dromara.maxkey.configuration.ApplicationConfig;
 import org.dromara.maxkey.listener.DynamicGroupsListenerAdapter;
@@ -53,7 +53,7 @@ public class MaxKeyMgtListenerConfig  {
     		.setCron("0 0/10 * * * ?")
     		.setJobClass(SessionListenerAdapter.class)
     		.setJobData("sessionManager",sessionManager)
-    		.setJobData("category", CATEGORY.MGMT)
+    		.setJobData("category", SessionCategory.MGMT)
     		.build();
         logger.debug("Session ListenerAdapter inited .");
     	return "sessionListenerAdapter";