Class JdbcUserAuthorizationRepository
java.lang.Object
com.irurueta.authserver.authorization.infrastructure.persistence.tokens.JdbcUserAuthorizationRepository
- All Implemented Interfaces:
UserAuthorizationRepository
@Repository
public class JdbcUserAuthorizationRepository
extends Object
implements UserAuthorizationRepository
UserAuthorizationRepository over the oauth2_authorization table.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final StringStatement deleting the abandoned authorizations: no token was ever issued for them, so every expiry column is null, and they were created before the given instant.private static final StringStatement deleting the authorizations whose every token has expired.private final org.springframework.jdbc.core.simple.JdbcClientJDBC client used to run the statements. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintdeleteAbandoned(Instant createdBefore) Deletes the abandoned authorizations: those that never got any token (an authorization or consent request the user never completed) and were created before an instant.intdeleteByPrincipalName(String principalName) Deletes every authorization granted to a user.intdeleteExpired(Instant now) Deletes the authorizations whose every token has expired.
-
Field Details
-
DELETE_EXPIRED
Statement deleting the authorizations whose every token has expired.GREATESTignores the tokens an authorization does not have, and is null for an authorization without any expiry, which is kept here and removed bydeleteAbandoned(Instant)once it is old enough.- See Also:
-
DELETE_ABANDONED
Statement deleting the abandoned authorizations: no token was ever issued for them, so every expiry column is null, and they were created before the given instant.- See Also:
-
jdbcClient
private final org.springframework.jdbc.core.simple.JdbcClient jdbcClientJDBC client used to run the statements.
-
-
Constructor Details
-
JdbcUserAuthorizationRepository
public JdbcUserAuthorizationRepository()
-
-
Method Details
-
deleteByPrincipalName
Description copied from interface:UserAuthorizationRepositoryDeletes every authorization granted to a user.- Specified by:
deleteByPrincipalNamein interfaceUserAuthorizationRepository- Parameters:
principalName- name of the user the authorizations were granted to.- Returns:
- the number of deleted authorizations.
-
deleteExpired
Description copied from interface:UserAuthorizationRepositoryDeletes the authorizations whose every token has expired.- Specified by:
deleteExpiredin interfaceUserAuthorizationRepository- Parameters:
now- current instant.- Returns:
- the number of deleted authorizations.
-
deleteAbandoned
Description copied from interface:UserAuthorizationRepositoryDeletes the abandoned authorizations: those that never got any token (an authorization or consent request the user never completed) and were created before an instant.- Specified by:
deleteAbandonedin interfaceUserAuthorizationRepository- Parameters:
createdBefore- instant before which an abandoned authorization is deleted.- Returns:
- the number of deleted authorizations.
-