Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
MaxKey单点登录官方(MaxKeyTop)
MaxKey
提交
69aa4f27
MaxKey
项目概览
MaxKey单点登录官方(MaxKeyTop)
/
MaxKey
9 个月 前同步成功
通知
75
Star
3
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
MaxKey
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
69aa4f27
编写于
4月 29, 2022
作者:
M
MaxKey
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
SessionManager
上级
5f0f1fa7
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
91 addition
and
59 deletion
+91
-59
maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/session/AbstractSessionManager.java
...java/org/maxkey/authn/session/AbstractSessionManager.java
+2
-0
maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/session/InMemorySessionManager.java
...java/org/maxkey/authn/session/InMemorySessionManager.java
+10
-4
maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/session/RedisSessionManager.java
...in/java/org/maxkey/authn/session/RedisSessionManager.java
+13
-11
maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/session/SessionManagerFactory.java
.../java/org/maxkey/authn/session/SessionManagerFactory.java
+8
-7
maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/support/rememberme/AbstractRemeberMeService.java
...ey/authn/support/rememberme/AbstractRemeberMeService.java
+5
-3
maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/support/rememberme/JdbcRemeberMeService.java
...maxkey/authn/support/rememberme/JdbcRemeberMeService.java
+5
-1
maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/autoconfigure/AuthenticationAutoConfiguration.java
...maxkey/autoconfigure/AuthenticationAutoConfiguration.java
+15
-14
maxkey-core/src/main/java/org/maxkey/configuration/AuthJwkConfig.java
...src/main/java/org/maxkey/configuration/AuthJwkConfig.java
+6
-0
maxkey-webs/maxkey-web-maxkey/src/main/java/org/maxkey/web/contorller/LoginEntryPoint.java
.../main/java/org/maxkey/web/contorller/LoginEntryPoint.java
+7
-7
maxkey-webs/maxkey-web-maxkey/src/main/resources/application-http.properties
...web-maxkey/src/main/resources/application-http.properties
+10
-7
maxkey-webs/maxkey-web-maxkey/src/main/resources/application-https.properties
...eb-maxkey/src/main/resources/application-https.properties
+10
-5
未找到文件。
maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/session/AbstractSessionManager.java
浏览文件 @
69aa4f27
...
@@ -37,6 +37,8 @@ public class AbstractSessionManager implements SessionManager{
...
@@ -37,6 +37,8 @@ public class AbstractSessionManager implements SessionManager{
protected
JdbcTemplate
jdbcTemplate
;
protected
JdbcTemplate
jdbcTemplate
;
protected
int
validitySeconds
=
60
*
30
;
//default 30 minutes.
private
static
final
String
DEFAULT_DEFAULT_SELECT_STATEMENT
=
private
static
final
String
DEFAULT_DEFAULT_SELECT_STATEMENT
=
"select id,sessionid,userId,username,displayname,logintime from mxk_history_login where sessionstatus = 1"
;
"select id,sessionid,userId,username,displayname,logintime from mxk_history_login where sessionstatus = 1"
;
...
...
maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/session/InMemorySessionManager.java
浏览文件 @
69aa4f27
...
@@ -34,13 +34,19 @@ public class InMemorySessionManager extends AbstractSessionManager{
...
@@ -34,13 +34,19 @@ public class InMemorySessionManager extends AbstractSessionManager{
protected
static
Cache
<
String
,
Session
>
sessionStore
=
protected
static
Cache
<
String
,
Session
>
sessionStore
=
Caffeine
.
newBuilder
()
Caffeine
.
newBuilder
()
.
expireAfterWrite
(
3
0
,
TimeUnit
.
MINUTES
)
.
expireAfterWrite
(
1
0
,
TimeUnit
.
MINUTES
)
.
maximumSize
(
200000
)
.
maximumSize
(
200000
0
)
.
build
();
.
build
();
public
InMemorySessionManager
(
JdbcTemplate
jdbcTemplate
)
{
public
InMemorySessionManager
(
JdbcTemplate
jdbcTemplate
,
int
validitySeconds
)
{
super
();
super
();
this
.
jdbcTemplate
=
jdbcTemplate
;
this
.
jdbcTemplate
=
jdbcTemplate
;
sessionStore
=
Caffeine
.
newBuilder
()
.
expireAfterWrite
(
validitySeconds
,
TimeUnit
.
SECONDS
)
.
maximumSize
(
2000000
)
.
build
();
}
}
@Override
@Override
...
@@ -65,7 +71,7 @@ public class InMemorySessionManager extends AbstractSessionManager{
...
@@ -65,7 +71,7 @@ public class InMemorySessionManager extends AbstractSessionManager{
public
void
setValiditySeconds
(
int
validitySeconds
)
{
public
void
setValiditySeconds
(
int
validitySeconds
)
{
sessionStore
=
sessionStore
=
Caffeine
.
newBuilder
()
Caffeine
.
newBuilder
()
.
expireAfterWrite
(
validitySeconds
/
60
,
TimeUnit
.
MINUTE
S
)
.
expireAfterWrite
(
validitySeconds
,
TimeUnit
.
SECOND
S
)
.
maximumSize
(
200000
)
.
maximumSize
(
200000
)
.
build
();
.
build
();
...
...
maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/session/RedisSessionManager.java
浏览文件 @
69aa4f27
...
@@ -30,8 +30,6 @@ import org.springframework.jdbc.core.JdbcTemplate;
...
@@ -30,8 +30,6 @@ import org.springframework.jdbc.core.JdbcTemplate;
public
class
RedisSessionManager
extends
AbstractSessionManager
{
public
class
RedisSessionManager
extends
AbstractSessionManager
{
private
static
final
Logger
_logger
=
LoggerFactory
.
getLogger
(
RedisSessionManager
.
class
);
private
static
final
Logger
_logger
=
LoggerFactory
.
getLogger
(
RedisSessionManager
.
class
);
protected
int
serviceTicketValiditySeconds
=
60
*
30
;
//default 30 minutes.
RedisConnectionFactory
connectionFactory
;
RedisConnectionFactory
connectionFactory
;
public
static
String
PREFIX
=
"REDIS_SESSION_"
;
public
static
String
PREFIX
=
"REDIS_SESSION_"
;
...
@@ -40,10 +38,11 @@ public class RedisSessionManager extends AbstractSessionManager {
...
@@ -40,10 +38,11 @@ public class RedisSessionManager extends AbstractSessionManager {
*/
*/
public
RedisSessionManager
(
public
RedisSessionManager
(
RedisConnectionFactory
connectionFactory
,
RedisConnectionFactory
connectionFactory
,
JdbcTemplate
jdbcTemplate
)
{
JdbcTemplate
jdbcTemplate
,
int
validitySeconds
)
{
super
();
super
();
this
.
connectionFactory
=
connectionFactory
;
this
.
connectionFactory
=
connectionFactory
;
this
.
jdbcTemplate
=
jdbcTemplate
;
this
.
jdbcTemplate
=
jdbcTemplate
;
this
.
validitySeconds
=
validitySeconds
;
}
}
/**
/**
...
@@ -58,9 +57,9 @@ public class RedisSessionManager extends AbstractSessionManager {
...
@@ -58,9 +57,9 @@ public class RedisSessionManager extends AbstractSessionManager {
}
}
@Override
@Override
public
void
create
(
String
sessionId
,
Session
ticket
)
{
public
void
create
(
String
sessionId
,
Session
session
)
{
RedisConnection
conn
=
connectionFactory
.
getConnection
();
RedisConnection
conn
=
connectionFactory
.
getConnection
();
conn
.
setexObject
(
PREFIX
+
sessionId
,
serviceTicketValiditySeconds
,
ticket
);
conn
.
setexObject
(
PREFIX
+
sessionId
,
validitySeconds
,
session
);
conn
.
close
();
conn
.
close
();
}
}
...
@@ -81,13 +80,16 @@ public class RedisSessionManager extends AbstractSessionManager {
...
@@ -81,13 +80,16 @@ public class RedisSessionManager extends AbstractSessionManager {
return
session
;
return
session
;
}
}
@Override
public
void
setValiditySeconds
(
int
validitySeconds
)
{
public
int
getValiditySeconds
()
{
this
.
serviceTicketValiditySeconds
=
validitySeconds
;
return
validitySeconds
;
}
}
@Override
public
void
setValiditySeconds
(
int
validitySeconds
)
{
this
.
validitySeconds
=
validitySeconds
;
}
@Override
public
void
refresh
(
String
sessionId
,
LocalTime
refreshTime
)
{
public
void
refresh
(
String
sessionId
,
LocalTime
refreshTime
)
{
Session
session
=
get
(
sessionId
);
Session
session
=
get
(
sessionId
);
session
.
setLastAccessTime
(
refreshTime
);
session
.
setLastAccessTime
(
refreshTime
);
...
...
maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/session/SessionManagerFactory.java
浏览文件 @
69aa4f27
/*
/*
* Copyright [202
1
] [MaxKey of copyright http://www.maxkey.top]
* Copyright [202
2
] [MaxKey of copyright http://www.maxkey.top]
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -30,17 +30,18 @@ public class SessionManagerFactory {
...
@@ -30,17 +30,18 @@ public class SessionManagerFactory {
public
SessionManager
getManager
(
public
SessionManager
getManager
(
int
persistence
,
int
persistence
,
JdbcTemplate
jdbcTemplate
,
JdbcTemplate
jdbcTemplate
,
RedisConnectionFactory
redisConnFactory
){
RedisConnectionFactory
redisConnFactory
,
int
validitySeconds
){
SessionManager
sessionService
=
null
;
SessionManager
sessionService
=
null
;
if
(
persistence
==
ConstsPersistence
.
INMEMORY
)
{
if
(
persistence
==
ConstsPersistence
.
INMEMORY
)
{
sessionService
=
new
InMemorySessionManager
(
jdbcTemplate
);
sessionService
=
new
InMemorySessionManager
(
jdbcTemplate
,
validitySeconds
);
_logger
.
debug
(
"InMemorySession
Service
"
);
_logger
.
debug
(
"InMemorySession
Manager
"
);
}
else
if
(
persistence
==
ConstsPersistence
.
JDBC
)
{
}
else
if
(
persistence
==
ConstsPersistence
.
JDBC
)
{
_logger
.
debug
(
"JdbcSessionService not support "
);
_logger
.
debug
(
"JdbcSessionService not support "
);
}
else
if
(
persistence
==
ConstsPersistence
.
REDIS
)
{
}
else
if
(
persistence
==
ConstsPersistence
.
REDIS
)
{
sessionService
=
new
RedisSessionManager
(
redisConnFactory
,
jdbcTemplate
);
sessionService
=
new
RedisSessionManager
(
_logger
.
debug
(
"RedisSessionService"
);
redisConnFactory
,
jdbcTemplate
,
validitySeconds
);
_logger
.
debug
(
"RedisSessionManager"
);
}
}
return
sessionService
;
return
sessionService
;
...
...
maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/support/rememberme/AbstractRemeberMeService.java
浏览文件 @
69aa4f27
...
@@ -89,8 +89,8 @@ public abstract class AbstractRemeberMeService {
...
@@ -89,8 +89,8 @@ public abstract class AbstractRemeberMeService {
return
true
;
return
true
;
}
}
public
RemeberMe
resolve
(
String
rememberMe
Token
)
throws
ParseException
{
public
RemeberMe
resolve
(
String
rememberMe
Jwt
)
throws
ParseException
{
JWTClaimsSet
claims
=
authJwtService
.
resolve
(
rememberMe
Token
);
JWTClaimsSet
claims
=
authJwtService
.
resolve
(
rememberMe
Jwt
);
RemeberMe
remeberMe
=
new
RemeberMe
();
RemeberMe
remeberMe
=
new
RemeberMe
();
remeberMe
.
setId
(
claims
.
getJWTID
());
remeberMe
.
setId
(
claims
.
getJWTID
());
remeberMe
.
setUsername
(
claims
.
getSubject
());
remeberMe
.
setUsername
(
claims
.
getSubject
());
...
@@ -117,7 +117,9 @@ public abstract class AbstractRemeberMeService {
...
@@ -117,7 +117,9 @@ public abstract class AbstractRemeberMeService {
}
}
public
void
setValidity
(
Integer
validity
)
{
public
void
setValidity
(
Integer
validity
)
{
this
.
validity
=
validity
;
if
(
validity
!=
0
)
{
this
.
validity
=
validity
;
}
}
}
...
...
maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/support/rememberme/JdbcRemeberMeService.java
浏览文件 @
69aa4f27
...
@@ -50,10 +50,14 @@ public class JdbcRemeberMeService extends AbstractRemeberMeService {
...
@@ -50,10 +50,14 @@ public class JdbcRemeberMeService extends AbstractRemeberMeService {
public
JdbcRemeberMeService
(
public
JdbcRemeberMeService
(
JdbcTemplate
jdbcTemplate
,
JdbcTemplate
jdbcTemplate
,
ApplicationConfig
applicationConfig
,
ApplicationConfig
applicationConfig
,
AuthJwtService
authJwtService
)
{
AuthJwtService
authJwtService
,
int
validity
)
{
this
.
jdbcTemplate
=
jdbcTemplate
;
this
.
jdbcTemplate
=
jdbcTemplate
;
this
.
applicationConfig
=
applicationConfig
;
this
.
applicationConfig
=
applicationConfig
;
this
.
authJwtService
=
authJwtService
;
this
.
authJwtService
=
authJwtService
;
if
(
validity
!=
0
)
{
this
.
validity
=
validity
;
}
}
}
@Override
@Override
...
...
maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/autoconfigure/AuthenticationAutoConfiguration.java
浏览文件 @
69aa4f27
...
@@ -70,7 +70,7 @@ public class AuthenticationAutoConfiguration implements InitializingBean {
...
@@ -70,7 +70,7 @@ public class AuthenticationAutoConfiguration implements InitializingBean {
return
new
SavedRequestAwareAuthenticationSuccessHandler
();
return
new
SavedRequestAwareAuthenticationSuccessHandler
();
}
}
@Bean
(
name
=
"authenticationProvider"
)
@Bean
public
AbstractAuthenticationProvider
authenticationProvider
(
public
AbstractAuthenticationProvider
authenticationProvider
(
AbstractAuthenticationProvider
normalAuthenticationProvider
,
AbstractAuthenticationProvider
normalAuthenticationProvider
,
AbstractAuthenticationProvider
mobileAuthenticationProvider
,
AbstractAuthenticationProvider
mobileAuthenticationProvider
,
...
@@ -100,7 +100,7 @@ public class AuthenticationAutoConfiguration implements InitializingBean {
...
@@ -100,7 +100,7 @@ public class AuthenticationAutoConfiguration implements InitializingBean {
);
);
}
}
@Bean
(
name
=
"mobileAuthenticationProvider"
)
@Bean
public
AbstractAuthenticationProvider
mobileAuthenticationProvider
(
public
AbstractAuthenticationProvider
mobileAuthenticationProvider
(
AbstractAuthenticationRealm
authenticationRealm
,
AbstractAuthenticationRealm
authenticationRealm
,
ApplicationConfig
applicationConfig
,
ApplicationConfig
applicationConfig
,
...
@@ -116,7 +116,7 @@ public class AuthenticationAutoConfiguration implements InitializingBean {
...
@@ -116,7 +116,7 @@ public class AuthenticationAutoConfiguration implements InitializingBean {
);
);
}
}
@Bean
(
name
=
"trustedAuthenticationProvider"
)
@Bean
public
AbstractAuthenticationProvider
trustedAuthenticationProvider
(
public
AbstractAuthenticationProvider
trustedAuthenticationProvider
(
AbstractAuthenticationRealm
authenticationRealm
,
AbstractAuthenticationRealm
authenticationRealm
,
ApplicationConfig
applicationConfig
,
ApplicationConfig
applicationConfig
,
...
@@ -130,7 +130,7 @@ public class AuthenticationAutoConfiguration implements InitializingBean {
...
@@ -130,7 +130,7 @@ public class AuthenticationAutoConfiguration implements InitializingBean {
);
);
}
}
@Bean
(
name
=
"authJwtService"
)
@Bean
public
AuthJwtService
authJwtService
(
public
AuthJwtService
authJwtService
(
AuthJwkConfig
authJwkConfig
,
AuthJwkConfig
authJwkConfig
,
RedisConnectionFactory
redisConnFactory
,
RedisConnectionFactory
redisConnFactory
,
...
@@ -162,23 +162,22 @@ public class AuthenticationAutoConfiguration implements InitializingBean {
...
@@ -162,23 +162,22 @@ public class AuthenticationAutoConfiguration implements InitializingBean {
otpAuthnService
.
setRedisOptTokenStore
(
redisOptTokenStore
);
otpAuthnService
.
setRedisOptTokenStore
(
redisOptTokenStore
);
}
}
_logger
.
debug
(
"OneTimePasswordService {} inited."
,
_logger
.
debug
(
"OneTimePasswordService {} inited."
,
persistence
==
ConstsPersistence
.
REDIS
?
"Redis"
:
"InMemory"
);
persistence
==
ConstsPersistence
.
REDIS
?
"Redis"
:
"InMemory"
);
return
otpAuthnService
;
return
otpAuthnService
;
}
}
@Bean
(
name
=
"passwordPolicyValidator"
)
@Bean
public
PasswordPolicyValidator
passwordPolicyValidator
(
JdbcTemplate
jdbcTemplate
,
MessageSource
messageSource
)
{
public
PasswordPolicyValidator
passwordPolicyValidator
(
JdbcTemplate
jdbcTemplate
,
MessageSource
messageSource
)
{
return
new
PasswordPolicyValidator
(
jdbcTemplate
,
messageSource
);
return
new
PasswordPolicyValidator
(
jdbcTemplate
,
messageSource
);
}
}
@Bean
(
name
=
"loginRepository"
)
@Bean
public
LoginRepository
loginRepository
(
JdbcTemplate
jdbcTemplate
)
{
public
LoginRepository
loginRepository
(
JdbcTemplate
jdbcTemplate
)
{
return
new
LoginRepository
(
jdbcTemplate
);
return
new
LoginRepository
(
jdbcTemplate
);
}
}
@Bean
(
name
=
"loginHistoryRepository"
)
@Bean
public
LoginHistoryRepository
L
oginHistoryRepository
(
JdbcTemplate
jdbcTemplate
)
{
public
LoginHistoryRepository
l
oginHistoryRepository
(
JdbcTemplate
jdbcTemplate
)
{
return
new
LoginHistoryRepository
(
jdbcTemplate
);
return
new
LoginHistoryRepository
(
jdbcTemplate
);
}
}
...
@@ -188,12 +187,12 @@ public class AuthenticationAutoConfiguration implements InitializingBean {
...
@@ -188,12 +187,12 @@ public class AuthenticationAutoConfiguration implements InitializingBean {
@Value
(
"${maxkey.server.persistence}"
)
int
persistence
,
@Value
(
"${maxkey.server.persistence}"
)
int
persistence
,
JdbcTemplate
jdbcTemplate
,
JdbcTemplate
jdbcTemplate
,
RedisConnectionFactory
redisConnFactory
,
RedisConnectionFactory
redisConnFactory
,
@Value
(
"${
server.servlet
.session.timeout:1800}"
)
int
timeout
@Value
(
"${
maxkey
.session.timeout:1800}"
)
int
timeout
)
{
)
{
_logger
.
trace
(
"session timeout "
+
timeout
);
SessionManager
sessionManager
=
SessionManager
sessionManager
=
new
SessionManagerFactory
().
getManager
(
persistence
,
jdbcTemplate
,
redisConnFactory
);
new
SessionManagerFactory
().
getManager
(
sessionManager
.
setValiditySeconds
(
timeout
);
persistence
,
jdbcTemplate
,
redisConnFactory
,
timeout
);
_logger
.
trace
(
"onlineTicket timeout "
+
timeout
);
return
sessionManager
;
return
sessionManager
;
}
}
...
@@ -209,7 +208,9 @@ public class AuthenticationAutoConfiguration implements InitializingBean {
...
@@ -209,7 +208,9 @@ public class AuthenticationAutoConfiguration implements InitializingBean {
ApplicationConfig
applicationConfig
,
ApplicationConfig
applicationConfig
,
AuthJwtService
authJwtService
,
AuthJwtService
authJwtService
,
JdbcTemplate
jdbcTemplate
)
{
JdbcTemplate
jdbcTemplate
)
{
return
new
JdbcRemeberMeService
(
jdbcTemplate
,
applicationConfig
,
authJwtService
);
_logger
.
trace
(
"init remeberMeService , validity {}."
,
validity
);
return
new
JdbcRemeberMeService
(
jdbcTemplate
,
applicationConfig
,
authJwtService
,
validity
);
}
}
@Bean
@Bean
...
...
maxkey-core/src/main/java/org/maxkey/configuration/AuthJwkConfig.java
浏览文件 @
69aa4f27
...
@@ -33,6 +33,12 @@ public class AuthJwkConfig {
...
@@ -33,6 +33,12 @@ public class AuthJwkConfig {
@Value
(
"${maxkey.auth.jwt.secret}"
)
@Value
(
"${maxkey.auth.jwt.secret}"
)
String
secret
;
String
secret
;
@Value
(
"${maxkey.session.timeout}"
)
String
refreshExpire
;
@Value
(
"${maxkey.auth.jwt.refresh.secret}"
)
String
refreshSecret
;
public
AuthJwkConfig
()
{
public
AuthJwkConfig
()
{
super
();
super
();
...
...
maxkey-webs/maxkey-web-maxkey/src/main/java/org/maxkey/web/contorller/LoginEntryPoint.java
浏览文件 @
69aa4f27
...
@@ -108,13 +108,13 @@ public class LoginEntryPoint {
...
@@ -108,13 +108,13 @@ public class LoginEntryPoint {
@Operation
(
summary
=
"登录接口"
,
description
=
"用户登录地址"
,
method
=
"GET"
)
@Operation
(
summary
=
"登录接口"
,
description
=
"用户登录地址"
,
method
=
"GET"
)
@RequestMapping
(
value
={
"/get"
},
produces
=
{
MediaType
.
APPLICATION_JSON_VALUE
})
@RequestMapping
(
value
={
"/get"
},
produces
=
{
MediaType
.
APPLICATION_JSON_VALUE
})
public
ResponseEntity
<?>
get
(
public
ResponseEntity
<?>
get
(
@RequestParam
(
value
=
"remember_me"
,
required
=
false
)
String
rememberMe
Token
)
{
@RequestParam
(
value
=
"remember_me"
,
required
=
false
)
String
rememberMe
Jwt
)
{
_logger
.
debug
(
"/get."
);
_logger
.
debug
(
"/get."
);
//Remember Me
//Remember Me
if
(
StringUtils
.
isNotBlank
(
rememberMe
Token
)
if
(
StringUtils
.
isNotBlank
(
rememberMe
Jwt
)
&&
authJwtService
.
validateJwtToken
(
rememberMe
Token
))
{
&&
authJwtService
.
validateJwtToken
(
rememberMe
Jwt
))
{
try
{
try
{
RemeberMe
remeberMe
=
remeberMeService
.
resolve
(
rememberMe
Token
);
RemeberMe
remeberMe
=
remeberMeService
.
resolve
(
rememberMe
Jwt
);
if
(
remeberMe
!=
null
)
{
if
(
remeberMe
!=
null
)
{
LoginCredential
credential
=
new
LoginCredential
();
LoginCredential
credential
=
new
LoginCredential
();
String
remeberMeJwt
=
remeberMeService
.
updateRemeberMe
(
remeberMe
);
String
remeberMeJwt
=
remeberMeService
.
updateRemeberMe
(
remeberMe
);
...
@@ -209,9 +209,9 @@ public class LoginEntryPoint {
...
@@ -209,9 +209,9 @@ public class LoginEntryPoint {
* @return
* @return
*/
*/
@RequestMapping
(
value
={
"/congress"
},
produces
=
{
MediaType
.
APPLICATION_JSON_VALUE
})
@RequestMapping
(
value
={
"/congress"
},
produces
=
{
MediaType
.
APPLICATION_JSON_VALUE
})
public
ResponseEntity
<?>
congress
(
@RequestBody
LoginCredential
loginC
redential
)
{
public
ResponseEntity
<?>
congress
(
@RequestBody
LoginCredential
c
redential
)
{
if
(
StringUtils
.
isNotBlank
(
loginC
redential
.
getCongress
())){
if
(
StringUtils
.
isNotBlank
(
c
redential
.
getCongress
())){
AuthJwt
authJwt
=
authJwtService
.
consumeCongress
(
loginC
redential
.
getCongress
());
AuthJwt
authJwt
=
authJwtService
.
consumeCongress
(
c
redential
.
getCongress
());
if
(
authJwt
!=
null
)
{
if
(
authJwt
!=
null
)
{
return
new
Message
<
AuthJwt
>(
authJwt
).
buildResponse
();
return
new
Message
<
AuthJwt
>(
authJwt
).
buildResponse
();
}
}
...
...
maxkey-webs/maxkey-web-maxkey/src/main/resources/application-http.properties
浏览文件 @
69aa4f27
...
@@ -17,10 +17,12 @@
...
@@ -17,10 +17,12 @@
############################################################################
############################################################################
#server port
#server port
server.port
=
${SERVER_PORT:8080}
server.port
=
${SERVER_PORT:8080}
#session default 1800
#session default 600
#1800s =30m
#600s =10m
#28800s=8h
#1800s =30m
server.servlet.session.timeout
=
${SERVER_SESSION_TIMEOUT:1800}
#3600s =1h
#28800s =8h
server.servlet.session.timeout
=
${SERVLET_SESSION_TIMEOUT:600}
#server context path
#server context path
server.servlet.context-path
=
/maxkey
server.servlet.context-path
=
/maxkey
#nacos discovery
#nacos discovery
...
@@ -49,11 +51,12 @@ maxkey.server.persistence =${SERVER_PERSISTENCE:0}
...
@@ -49,11 +51,12 @@ maxkey.server.persistence =${SERVER_PERSISTENCE:0}
maxkey.server.message.queue
=
${SERVER_MESSAGE_QUEUE:none}
maxkey.server.message.queue
=
${SERVER_MESSAGE_QUEUE:none}
#issuer name
#issuer name
maxkey.app.issuer
=
CN=ConSec,CN=COM,CN=SH
maxkey.app.issuer
=
CN=ConSec,CN=COM,CN=SH
#must > jwt expire * 2
maxkey.session.timeout
=
${SERVER_SESSION_TIMEOUT:1800}
maxkey.auth.jwt.issuer
=
${maxkey.server.uri}
maxkey.auth.jwt.issuer
=
${maxkey.server.uri}
maxkey.auth.jwt.expire
=
864
00
maxkey.auth.jwt.expire
=
6
00
maxkey.auth.jwt.secret
=
7heM-14BtxjyKPuH3ITIm7q2-ps5MuBirWCsrrdbzzSAOuSPrbQYiaJ54AeA0uH2XdkYy3hHAkTFIsieGkyqxOJZ_dQzrCbaYISH9rhUZAKYx8tUY0wkE4ArOC6LqHDJarR6UIcMsARakK9U4dhoOPO1cj74XytemI-w6ACYfzRUn_Rn4e-CQMcnD1C56oNEukwalf06xVgXl41h6K8IBEzLVod58y_VfvFn-NGWpNG0fy_Qxng6dg8Dgva2DobvzMN2eejHGLGB-x809MvC4zbG7CKNVlcrzMYDt2Gt2sOVDrt2l9YqJNfgaLFjrOEVw5cuXemGkX1MvHj6TAsbLg
maxkey.auth.jwt.secret
=
7heM-14BtxjyKPuH3ITIm7q2-ps5MuBirWCsrrdbzzSAOuSPrbQYiaJ54AeA0uH2XdkYy3hHAkTFIsieGkyqxOJZ_dQzrCbaYISH9rhUZAKYx8tUY0wkE4ArOC6LqHDJarR6UIcMsARakK9U4dhoOPO1cj74XytemI-w6ACYfzRUn_Rn4e-CQMcnD1C56oNEukwalf06xVgXl41h6K8IBEzLVod58y_VfvFn-NGWpNG0fy_Qxng6dg8Dgva2DobvzMN2eejHGLGB-x809MvC4zbG7CKNVlcrzMYDt2Gt2sOVDrt2l9YqJNfgaLFjrOEVw5cuXemGkX1MvHj6TAsbLg
maxkey.auth.jwt.refresh.expire
=
86400
maxkey.auth.jwt.refresh.secret
=
7heM-14BtxjyKPuH3ITIm7q2-ps5MuBirWCsrrdbzzSAOuSPrbQYiaJ54AeA0uH2XdkYy3hHAkTFIsieGkyqxOJZ_dQzrCbaYISH9rhUZAKYx8tUY0wkE4ArOC6LqHDJarR6UIcMsARakK9U4dhoOPO1cj74XytemI-w6ACYfzRUn_Rn4e-CQMcnD1C56oNEukwalf06xVgXl41h6K8IBEzLVod58y_VfvFn-NGWpNG0fy_Qxng6dg8Dgva2DobvzMN2eejHGLGB-x809MvC4zbG7CKNVlcrzMYDt2Gt2sOVDrt2l9YqJNfgaLFjrOEVw5cuXemGkX1MvHj6TAsbLg
maxkey.auth.jwt.refresh.secret
=
7heM-14BtxjyKPuH3ITIm7q2-ps5MuBirWCsrrdbzzSAOuSPrbQYiaJ54AeA0uH2XdkYy3hHAkTFIsieGkyqxOJZ_dQzrCbaYISH9rhUZAKYx8tUY0wkE4ArOC6LqHDJarR6UIcMsARakK9U4dhoOPO1cj74XytemI-w6ACYfzRUn_Rn4e-CQMcnD1C56oNEukwalf06xVgXl41h6K8IBEzLVod58y_VfvFn-NGWpNG0fy_Qxng6dg8Dgva2DobvzMN2eejHGLGB-x809MvC4zbG7CKNVlcrzMYDt2Gt2sOVDrt2l9YqJNfgaLFjrOEVw5cuXemGkX1MvHj6TAsbLg
############################################################################
############################################################################
#Login configuration #
#Login configuration #
...
@@ -72,7 +75,7 @@ maxkey.login.kerberos =false
...
@@ -72,7 +75,7 @@ maxkey.login.kerberos =false
maxkey.login.wsfederation
=
false
maxkey.login.wsfederation
=
false
#remeberme
#remeberme
maxkey.login.remeberme
=
${LOGIN_REMEBERME:true}
maxkey.login.remeberme
=
${LOGIN_REMEBERME:true}
#validity
#validity
day
maxkey.login.remeberme.validity
=
0
maxkey.login.remeberme.validity
=
0
#JWT support
#JWT support
maxkey.login.jwt
=
${LOGIN_JWT:true}
maxkey.login.jwt
=
${LOGIN_JWT:true}
...
...
maxkey-webs/maxkey-web-maxkey/src/main/resources/application-https.properties
浏览文件 @
69aa4f27
...
@@ -17,10 +17,12 @@
...
@@ -17,10 +17,12 @@
############################################################################
############################################################################
#server port
#server port
server.port
=
${SERVER_PORT:443}
server.port
=
${SERVER_PORT:443}
#session default 1800
#session default 600
#1800s =30m
#600s =10m
#28800s=8h
#1800s =30m
server.servlet.session.timeout
=
${SERVER_SESSION_TIMEOUT:1800}
#3600s =1h
#28800s =8h
server.servlet.session.timeout
=
${SERVLET_SESSION_TIMEOUT:600}
#server context path
#server context path
server.servlet.context-path
=
/maxkey
server.servlet.context-path
=
/maxkey
#nacos discovery
#nacos discovery
...
@@ -45,10 +47,13 @@ maxkey.server.persistence =${SERVER_PERSISTENCE:0}
...
@@ -45,10 +47,13 @@ maxkey.server.persistence =${SERVER_PERSISTENCE:0}
maxkey.server.message.queue
=
${SERVER_MESSAGE_QUEUE:none}
maxkey.server.message.queue
=
${SERVER_MESSAGE_QUEUE:none}
#issuer name
#issuer name
maxkey.app.issuer
=
CN=ConSec,CN=COM,CN=SH
maxkey.app.issuer
=
CN=ConSec,CN=COM,CN=SH
#must > jwt expire * 2
maxkey.session.timeout
=
${SERVER_SESSION_TIMEOUT:1800}
maxkey.auth.jwt.expire
=
86400
maxkey.auth.jwt.issuer
=
${maxkey.server.uri}
maxkey.auth.jwt.issuer
=
${maxkey.server.uri}
maxkey.auth.jwt.expire
=
600
maxkey.auth.jwt.secret
=
7heM-14BtxjyKPuH3ITIm7q2-ps5MuBirWCsrrdbzzSAOuSPrbQYiaJ54AeA0uH2XdkYy3hHAkTFIsieGkyqxOJZ_dQzrCbaYISH9rhUZAKYx8tUY0wkE4ArOC6LqHDJarR6UIcMsARakK9U4dhoOPO1cj74XytemI-w6ACYfzRUn_Rn4e-CQMcnD1C56oNEukwalf06xVgXl41h6K8IBEzLVod58y_VfvFn-NGWpNG0fy_Qxng6dg8Dgva2DobvzMN2eejHGLGB-x809MvC4zbG7CKNVlcrzMYDt2Gt2sOVDrt2l9YqJNfgaLFjrOEVw5cuXemGkX1MvHj6TAsbLg
maxkey.auth.jwt.secret
=
7heM-14BtxjyKPuH3ITIm7q2-ps5MuBirWCsrrdbzzSAOuSPrbQYiaJ54AeA0uH2XdkYy3hHAkTFIsieGkyqxOJZ_dQzrCbaYISH9rhUZAKYx8tUY0wkE4ArOC6LqHDJarR6UIcMsARakK9U4dhoOPO1cj74XytemI-w6ACYfzRUn_Rn4e-CQMcnD1C56oNEukwalf06xVgXl41h6K8IBEzLVod58y_VfvFn-NGWpNG0fy_Qxng6dg8Dgva2DobvzMN2eejHGLGB-x809MvC4zbG7CKNVlcrzMYDt2Gt2sOVDrt2l9YqJNfgaLFjrOEVw5cuXemGkX1MvHj6TAsbLg
maxkey.auth.jwt.refresh.secret
=
7heM-14BtxjyKPuH3ITIm7q2-ps5MuBirWCsrrdbzzSAOuSPrbQYiaJ54AeA0uH2XdkYy3hHAkTFIsieGkyqxOJZ_dQzrCbaYISH9rhUZAKYx8tUY0wkE4ArOC6LqHDJarR6UIcMsARakK9U4dhoOPO1cj74XytemI-w6ACYfzRUn_Rn4e-CQMcnD1C56oNEukwalf06xVgXl41h6K8IBEzLVod58y_VfvFn-NGWpNG0fy_Qxng6dg8Dgva2DobvzMN2eejHGLGB-x809MvC4zbG7CKNVlcrzMYDt2Gt2sOVDrt2l9YqJNfgaLFjrOEVw5cuXemGkX1MvHj6TAsbLg
############################################################################
############################################################################
#Login configuration #
#Login configuration #
############################################################################
############################################################################
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录