Interface HerodotusAuthorizationRepository
- All Superinterfaces:
cn.herodotus.engine.data.core.repository.BaseRepository<HerodotusAuthorization,,String> org.springframework.data.repository.CrudRepository<HerodotusAuthorization,,String> org.springframework.data.jpa.repository.JpaRepository<HerodotusAuthorization,,String> org.springframework.data.jpa.repository.JpaSpecificationExecutor<HerodotusAuthorization>,org.springframework.data.repository.ListCrudRepository<HerodotusAuthorization,,String> org.springframework.data.repository.ListPagingAndSortingRepository<HerodotusAuthorization,,String> org.springframework.data.repository.PagingAndSortingRepository<HerodotusAuthorization,,String> org.springframework.data.repository.query.QueryByExampleExecutor<HerodotusAuthorization>,org.springframework.data.repository.Repository<HerodotusAuthorization,String>
public interface HerodotusAuthorizationRepository
extends cn.herodotus.engine.data.core.repository.BaseRepository<HerodotusAuthorization,String>
Description: HerodotusAuthorizationRepository
- Author:
- : gengwei.zheng
- Date:
- : 2022/2/25 21:05
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.springframework.data.jpa.repository.JpaSpecificationExecutor
org.springframework.data.jpa.repository.JpaSpecificationExecutor.SpecificationFluentQuery<T extends Object> -
Method Summary
Modifier and TypeMethodDescriptionvoiddeleteByRefreshTokenExpiresAtBefore(LocalDateTime localDateTime) 根据 RefreshToken 过期时间,清理历史 Token信息findAllByRegisteredClientIdAndPrincipalNameAndAccessTokenExpiresAtAfter(String registeredClientId, String principalName, LocalDateTime localDateTime) 根据客户端ID和用户名查询未过期TokenfindByAccessTokenValue(String accessToken) 根据 Access Token 查询 OAuth2 认证信息findByAuthorizationCodeValue(String authorizationCode) 根据 authorizationCode 查询 OAuth2 认证信息findByDeviceCodeValue(String deviceCode) 根据 Device Code 查询 OAuth2 认证信息findByOidcIdTokenValue(String idToken) 根据 Id Token 查询 OAuth2 认证信息findByRefreshTokenValue(String refreshToken) 根据 Refresh Token 查询 OAuth2 认证信息findByState(String state) 根据 State 查询 OAuth2 认证信息findByUserCodeValue(String userCode) 根据 User Code 查询 OAuth2 认证信息Methods inherited from interface cn.herodotus.engine.data.core.repository.BaseRepository
count, count, deleteById, findAll, findAll, findAll, findAll, findAll, findAll, findById, findOneMethods inherited from interface org.springframework.data.repository.CrudRepository
delete, deleteAll, deleteAll, deleteAllById, existsById, saveMethods inherited from interface org.springframework.data.jpa.repository.JpaRepository
deleteAllByIdInBatch, deleteAllInBatch, deleteAllInBatch, deleteInBatch, findAll, findAll, flush, getById, getOne, getReferenceById, saveAllAndFlush, saveAndFlushMethods inherited from interface org.springframework.data.jpa.repository.JpaSpecificationExecutor
delete, exists, findAll, findByMethods inherited from interface org.springframework.data.repository.ListCrudRepository
findAllById, saveAllMethods inherited from interface org.springframework.data.repository.query.QueryByExampleExecutor
count, exists, findAll, findBy, findOne
-
Method Details
-
findByState
根据 State 查询 OAuth2 认证信息- Parameters:
state- OAuth2 Authorization Code 模式参数 State- Returns:
- OAuth2 认证信息
HerodotusAuthorization
-
findByAuthorizationCodeValue
@QueryHints() Optional<HerodotusAuthorization> findByAuthorizationCodeValue(String authorizationCode) 根据 authorizationCode 查询 OAuth2 认证信息- Parameters:
authorizationCode- OAuth2 Authorization Code 模式参数 code- Returns:
- OAuth2 认证信息
HerodotusAuthorization
-
findByAccessTokenValue
根据 Access Token 查询 OAuth2 认证信息- Parameters:
accessToken- OAuth2 accessToken- Returns:
- OAuth2 认证信息
HerodotusAuthorization
-
findByRefreshTokenValue
根据 Refresh Token 查询 OAuth2 认证信息- Parameters:
refreshToken- OAuth2 refreshToken- Returns:
- OAuth2 认证信息
HerodotusAuthorization
-
findByOidcIdTokenValue
根据 Id Token 查询 OAuth2 认证信息- Parameters:
idToken- OAuth2 idToken- Returns:
- OAuth2 认证信息
HerodotusAuthorization
-
findByUserCodeValue
根据 User Code 查询 OAuth2 认证信息- Parameters:
userCode- OAuth2 userCode- Returns:
- OAuth2 认证信息
HerodotusAuthorization
-
findByDeviceCodeValue
根据 Device Code 查询 OAuth2 认证信息- Parameters:
deviceCode- OAuth2 deviceCode- Returns:
- OAuth2 认证信息
HerodotusAuthorization
-
findAllByRegisteredClientIdAndPrincipalNameAndAccessTokenExpiresAtAfter
List<HerodotusAuthorization> findAllByRegisteredClientIdAndPrincipalNameAndAccessTokenExpiresAtAfter(String registeredClientId, String principalName, LocalDateTime localDateTime) 根据客户端ID和用户名查询未过期Token- Parameters:
registeredClientId- 客户端IDprincipalName- 用户名称localDateTime- 时间- Returns:
- 认证信息列表
-
deleteByRefreshTokenExpiresAtBefore
根据 RefreshToken 过期时间,清理历史 Token信息OAuth2Authorization 表中存在 AccessToken、OidcToken、RefreshToken 等三个过期时间。 正常的删除逻辑应该是三个过期时间都已经过期才行。但是有特殊情况: 1. OidcToken 的过期时间有可能为空,这就增加了 SQL 处理的复杂度。 2. 逻辑上 RefreshToken 的过期应该是最长的(这是默认配置正确的情况) 因此,目前就简单的根据 RefreshToken过期时间进行处理
- Parameters:
localDateTime- 时间
-