mirror of
https://gitee.com/dromara/MaxKey.git
synced 2025-12-06 17:08:29 +08:00
代码优化
This commit is contained in:
parent
fdd4501d13
commit
243b546a9a
@ -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;
|
||||
|
||||
@ -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;
|
||||
}
|
||||
@ -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) {
|
||||
|
||||
@ -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) {
|
||||
|
||||
@ -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'
|
||||
|
||||
@ -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 .");
|
||||
}
|
||||
|
||||
@ -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";
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user