public interface HerodotusAuthorizationRepository extends BaseRepository<HerodotusAuthorization,String>
Description: HerodotusAuthorizationRepository
| 限定符和类型 | 方法和说明 |
|---|---|
void |
deleteByRefreshTokenExpiresAtBefore(LocalDateTime localDateTime)
根据 RefreshToken 过期时间,清理历史 Token信息
OAuth2Authorization 表中存在 AccessToken、OidcToken、RefreshToken 等三个过期时间。
|
List<HerodotusAuthorization> |
findAllByRegisteredClientIdAndPrincipalNameAndAccessTokenExpiresAtAfter(String registeredClientId,
String principalName,
LocalDateTime localDateTime)
根据客户端ID和用户名查询未过期Token
|
Optional<HerodotusAuthorization> |
findByAccessTokenValue(String accessToken)
根据 Access Token 查询 OAuth2 认证信息
|
Optional<HerodotusAuthorization> |
findByAuthorizationCodeValue(String authorizationCode)
根据 authorizationCode 查询 OAuth2 认证信息
|
Optional<HerodotusAuthorization> |
findByRefreshTokenValue(String refreshToken)
根据 Refresh Token 查询 OAuth2 认证信息
|
Optional<HerodotusAuthorization> |
findByState(String state)
根据 State 查询 OAuth2 认证信息
|
count, count, deleteById, findAll, findAll, findAll, findAll, findAll, findAll, findById, findOnedeleteAllByIdInBatch, deleteAllInBatch, deleteAllInBatch, deleteInBatch, findAll, findAll, findAllById, flush, getById, getOne, getReferenceById, saveAll, saveAllAndFlush, saveAndFlushdelete, deleteAll, deleteAll, deleteAllById, existsById, save@QueryHints(value=) Optional<HerodotusAuthorization> findByState(String state)
state - OAuth2 Authorization Code 模式参数 StateHerodotusAuthorization@QueryHints(value=) Optional<HerodotusAuthorization> findByAuthorizationCodeValue(String authorizationCode)
authorizationCode - OAuth2 Authorization Code 模式参数 codeHerodotusAuthorization@QueryHints(value=) Optional<HerodotusAuthorization> findByAccessTokenValue(String accessToken)
accessToken - OAuth2 accessTokenHerodotusAuthorization@QueryHints(value=) Optional<HerodotusAuthorization> findByRefreshTokenValue(String refreshToken)
refreshToken - OAuth2 refreshTokenHerodotusAuthorizationList<HerodotusAuthorization> findAllByRegisteredClientIdAndPrincipalNameAndAccessTokenExpiresAtAfter(String registeredClientId, String principalName, LocalDateTime localDateTime)
registeredClientId - 客户端IDprincipalName - 用户名称localDateTime - 时间@Modifying @Transactional void deleteByRefreshTokenExpiresAtBefore(LocalDateTime localDateTime)
OAuth2Authorization 表中存在 AccessToken、OidcToken、RefreshToken 等三个过期时间。 正常的删除逻辑应该是三个过期时间都已经过期才行。但是有特殊情况: 1. OidcToken 的过期时间有可能为空,这就增加了 SQL 处理的复杂度。 2. 逻辑上 RefreshToken 的过期应该是最长的(这是默认配置正确的情况) 因此,目前就简单的根据 RefreshToken过期时间进行处理
localDateTime - 时间Copyright © 2023 Dromara. All rights reserved.