diff --git a/cloud/oauth-server/src/main/kotlin/pers/acp/admin/oauth/controller/api/LoginController.kt b/cloud/oauth-server/src/main/kotlin/pers/acp/admin/oauth/controller/api/TokenController.kt similarity index 93% rename from cloud/oauth-server/src/main/kotlin/pers/acp/admin/oauth/controller/api/LoginController.kt rename to cloud/oauth-server/src/main/kotlin/pers/acp/admin/oauth/controller/api/TokenController.kt index bd24fec5..cfefa2a6 100644 --- a/cloud/oauth-server/src/main/kotlin/pers/acp/admin/oauth/controller/api/LoginController.kt +++ b/cloud/oauth-server/src/main/kotlin/pers/acp/admin/oauth/controller/api/TokenController.kt @@ -30,8 +30,8 @@ import javax.validation.constraints.NotNull @Validated @RestController @RequestMapping(OauthApi.basePath) -@Api(tags = ["登录信息"]) -class LoginController @Autowired +@Api(tags = ["认证信息"]) +class TokenController @Autowired constructor( private val logAdapter: LogAdapter, private val applicationDomain: ApplicationDomain, @@ -62,7 +62,10 @@ constructor( OnlineInfoVo( appId = it.id, appName = it.appName, - count = securityTokenService.getTokensByAppId(it.id).size.toLong() + count = securityTokenService.getTokensByAppId(it.id) + .filter { token -> + !token.isExpired + }.size.toLong() ) ) } @@ -95,7 +98,9 @@ constructor( count = securityTokenService.getTokensByAppIdAndLoginNo( item.id, userInfo.loginNo - ).size.toLong() + ).filter { token -> + !token.isExpired + }.size.toLong() ) ) } diff --git a/cloud/oauth-server/src/main/kotlin/pers/acp/admin/oauth/controller/inner/InnerAuthController.kt b/cloud/oauth-server/src/main/kotlin/pers/acp/admin/oauth/controller/inner/InnerTokenController.kt similarity index 97% rename from cloud/oauth-server/src/main/kotlin/pers/acp/admin/oauth/controller/inner/InnerAuthController.kt rename to cloud/oauth-server/src/main/kotlin/pers/acp/admin/oauth/controller/inner/InnerTokenController.kt index db81c5ac..98d42241 100644 --- a/cloud/oauth-server/src/main/kotlin/pers/acp/admin/oauth/controller/inner/InnerAuthController.kt +++ b/cloud/oauth-server/src/main/kotlin/pers/acp/admin/oauth/controller/inner/InnerTokenController.kt @@ -30,8 +30,8 @@ import springfox.documentation.annotations.ApiIgnore @Validated @RestController @RequestMapping(CommonPath.innerBasePath) -@Api(tags = ["权限信息(内部接口)"]) -class InnerAuthController @Autowired +@Api(tags = ["认证信息(内部接口)"]) +class InnerTokenController @Autowired constructor( logAdapter: LogAdapter, private val securityTokenService: SecurityTokenService, diff --git a/cloud/oauth-server/src/main/kotlin/pers/acp/admin/oauth/controller/openinner/OpenInnerAuthController.kt b/cloud/oauth-server/src/main/kotlin/pers/acp/admin/oauth/controller/openinner/OpenInnerTokenController.kt similarity index 95% rename from cloud/oauth-server/src/main/kotlin/pers/acp/admin/oauth/controller/openinner/OpenInnerAuthController.kt rename to cloud/oauth-server/src/main/kotlin/pers/acp/admin/oauth/controller/openinner/OpenInnerTokenController.kt index 0ce448da..a9da3d88 100644 --- a/cloud/oauth-server/src/main/kotlin/pers/acp/admin/oauth/controller/openinner/OpenInnerAuthController.kt +++ b/cloud/oauth-server/src/main/kotlin/pers/acp/admin/oauth/controller/openinner/OpenInnerTokenController.kt @@ -23,8 +23,8 @@ import pers.acp.admin.oauth.domain.ModuleFuncDomain @Validated @RestController @RequestMapping(CommonPath.openInnerBasePath) -@Api(tags = ["权限信息(内部开放接口)"]) -class OpenInnerAuthController @Autowired +@Api(tags = ["认证信息(内部开放接口)"]) +class OpenInnerTokenController @Autowired constructor( logAdapter: LogAdapter, private val checkTokenEndpoint: CheckTokenEndpoint, diff --git a/cloud/oauth-server/src/main/kotlin/pers/acp/admin/oauth/token/UserPasswordAuthenticationToken.kt b/cloud/oauth-server/src/main/kotlin/pers/acp/admin/oauth/token/UserPasswordAuthenticationToken.kt index d30b7289..f319e7d1 100644 --- a/cloud/oauth-server/src/main/kotlin/pers/acp/admin/oauth/token/UserPasswordAuthenticationToken.kt +++ b/cloud/oauth-server/src/main/kotlin/pers/acp/admin/oauth/token/UserPasswordAuthenticationToken.kt @@ -2,16 +2,12 @@ package pers.acp.admin.oauth.token import org.springframework.security.authentication.AbstractAuthenticationToken import org.springframework.security.core.GrantedAuthority -import org.springframework.security.core.SpringSecurityCoreVersion +import java.io.Serializable -class UserPasswordAuthenticationToken : AbstractAuthenticationToken { +class UserPasswordAuthenticationToken : Serializable, AbstractAuthenticationToken { private var principal: Any? = null private var credentials: Any? = null - companion object { - private const val serialVersionUID = SpringSecurityCoreVersion.SERIAL_VERSION_UID - } - constructor(principal: Any?, credentials: Any?) : super(null) { this.principal = principal this.credentials = credentials @@ -30,4 +26,8 @@ class UserPasswordAuthenticationToken : AbstractAuthenticationToken { super.eraseCredentials() credentials = null } + + companion object { + private const val serialVersionUID: Long = -8266012108197485218L + } } \ No newline at end of file diff --git a/doc/version_history.md b/doc/version_history.md index 7e6c0092..9790360f 100644 --- a/doc/version_history.md +++ b/doc/version_history.md @@ -1,5 +1,14 @@ ## 版本更新记录 +##### release + +- Global + - [Upgrade] 优化中间件脚本[docker-compose-base.yaml](../dockerfiles/docker-compose-base.yaml) +- oauth-server + - [Upgrade] 优化 UserPasswordAuthenticationToken 序列化 + - [Upgrade] token查询过滤过期的token + - [Upgrade] 调整token相关controller名称 + ##### v5.1.3 - Global diff --git a/dockerfiles/docker-compose-base.yaml b/dockerfiles/docker-compose-base.yaml index 2ae2593e..e5926631 100644 --- a/dockerfiles/docker-compose-base.yaml +++ b/dockerfiles/docker-compose-base.yaml @@ -5,7 +5,7 @@ services: container_name: redis-acp restart: always ports: - - 6379:6379 + - "6379:6379" networks: - elk # command: redis-server --requirepass ${pwd} --notify-keyspace-events Eglx @@ -99,8 +99,8 @@ services: networks: - elk ports: - - 9200:9200 - - 9300:9300 + - "9200:9200" + - "9300:9300" environment: - TZ='Asia/Shanghai' - "ES_JAVA_OPTS=-Xms512m -Xmx512m" diff --git a/project.properties b/project.properties index 27f23909..8f1577ae 100644 --- a/project.properties +++ b/project.properties @@ -1,4 +1,4 @@ -gradleVersion=7.2 +gradleVersion=7.4 group=pers.acp version=5.1.3 encoding=UTF-8