Class JdbcRecoveryCodeRepository
java.lang.Object
com.irurueta.authserver.authorization.infrastructure.persistence.totp.JdbcRecoveryCodeRepository
- All Implemented Interfaces:
RecoveryCodeRepository
@Repository
public class JdbcRecoveryCodeRepository
extends Object
implements RecoveryCodeRepository
RecoveryCodeRepository over the recovery_codes table. It opens no transaction: replacing the codes
of a user runs in the caller's.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final StringStatement deleting every code of a user.private static final StringQuery returning the codes of a user that have not been spent.private static final StringStatement storing a code.private final org.springframework.jdbc.core.simple.JdbcClientJDBC client used to run the statements.private static final StringStatement that spends a code only when it is unused, atomically.private final RecoveryCodeRowMapperMaps a row to a code. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddeleteByUser(UUID userId) findUnused(UUID userId) booleanvoidreplaceAll(UUID userId, List<RecoveryCode> codes)
-
Field Details
-
DELETE_BY_USER
Statement deleting every code of a user.- See Also:
-
INSERT
Statement storing a code.- See Also:
-
FIND_UNUSED
Query returning the codes of a user that have not been spent.- See Also:
-
MARK_USED
Statement that spends a code only when it is unused, atomically.- See Also:
-
jdbcClient
private final org.springframework.jdbc.core.simple.JdbcClient jdbcClientJDBC client used to run the statements. -
recoveryCodeRowMapper
Maps a row to a code.
-
-
Constructor Details
-
JdbcRecoveryCodeRepository
public JdbcRecoveryCodeRepository()
-
-
Method Details
-
replaceAll
- Specified by:
replaceAllin interfaceRecoveryCodeRepository
-
findUnused
- Specified by:
findUnusedin interfaceRecoveryCodeRepository
-
markUsed
- Specified by:
markUsedin interfaceRecoveryCodeRepository
-
deleteByUser
- Specified by:
deleteByUserin interfaceRecoveryCodeRepository
-