接口 HerodotusAuthorizationRepository
- 所有超级接口:
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
- 作者:
- : gengwei.zheng
- Date:
- : 2022/2/25 21:05
-
方法概要
修饰符和类型方法说明voiddeleteByRefreshTokenExpiresAtBefore(LocalDateTime localDateTime) 根据 RefreshToken 过期时间,清理历史 Token信息findAllByRegisteredClientIdAndPrincipalNameAndAccessTokenExpiresAtAfter(String registeredClientId, String principalName, LocalDateTime localDateTime) 根据客户端ID和用户名查询未过期TokenfindByAccessTokenValue(String accessToken) 根据 Access Token 查询 OAuth2 认证信息findByAuthorizationCodeValue(String authorizationCode) 根据 authorizationCode 查询 OAuth2 认证信息findByRefreshTokenValue(String refreshToken) 根据 Refresh Token 查询 OAuth2 认证信息findByState(String state) 根据 State 查询 OAuth2 认证信息从接口继承的方法 cn.herodotus.engine.data.core.repository.BaseRepository
count, count, deleteById, findAll, findAll, findAll, findAll, findAll, findAll, findById, findOne从接口继承的方法 org.springframework.data.repository.CrudRepository
delete, deleteAll, deleteAll, deleteAllById, existsById, save从接口继承的方法 org.springframework.data.jpa.repository.JpaRepository
deleteAllByIdInBatch, deleteAllInBatch, deleteAllInBatch, deleteInBatch, findAll, findAll, flush, getById, getOne, getReferenceById, saveAllAndFlush, saveAndFlush从接口继承的方法 org.springframework.data.jpa.repository.JpaSpecificationExecutor
delete, exists, findBy从接口继承的方法 org.springframework.data.repository.ListCrudRepository
findAllById, saveAll从接口继承的方法 org.springframework.data.repository.query.QueryByExampleExecutor
count, exists, findAll, findBy, findOne
-
方法详细资料
-
findByState
根据 State 查询 OAuth2 认证信息- 参数:
state- OAuth2 Authorization Code 模式参数 State- 返回:
- OAuth2 认证信息
HerodotusAuthorization
-
findByAuthorizationCodeValue
@QueryHints() Optional<HerodotusAuthorization> findByAuthorizationCodeValue(String authorizationCode) 根据 authorizationCode 查询 OAuth2 认证信息- 参数:
authorizationCode- OAuth2 Authorization Code 模式参数 code- 返回:
- OAuth2 认证信息
HerodotusAuthorization
-
findByAccessTokenValue
根据 Access Token 查询 OAuth2 认证信息- 参数:
accessToken- OAuth2 accessToken- 返回:
- OAuth2 认证信息
HerodotusAuthorization
-
findByRefreshTokenValue
根据 Refresh Token 查询 OAuth2 认证信息- 参数:
refreshToken- OAuth2 refreshToken- 返回:
- OAuth2 认证信息
HerodotusAuthorization
-
findAllByRegisteredClientIdAndPrincipalNameAndAccessTokenExpiresAtAfter
List<HerodotusAuthorization> findAllByRegisteredClientIdAndPrincipalNameAndAccessTokenExpiresAtAfter(String registeredClientId, String principalName, LocalDateTime localDateTime) 根据客户端ID和用户名查询未过期Token- 参数:
registeredClientId- 客户端IDprincipalName- 用户名称localDateTime- 时间- 返回:
- 认证信息列表
-
deleteByRefreshTokenExpiresAtBefore
根据 RefreshToken 过期时间,清理历史 Token信息OAuth2Authorization 表中存在 AccessToken、OidcToken、RefreshToken 等三个过期时间。 正常的删除逻辑应该是三个过期时间都已经过期才行。但是有特殊情况: 1. OidcToken 的过期时间有可能为空,这就增加了 SQL 处理的复杂度。 2. 逻辑上 RefreshToken 的过期应该是最长的(这是默认配置正确的情况) 因此,目前就简单的根据 RefreshToken过期时间进行处理
- 参数:
localDateTime- 时间
-