Class JdbcSigningKeyRepository
java.lang.Object
com.irurueta.authserver.authorization.infrastructure.persistence.keys.JdbcSigningKeyRepository
- All Implemented Interfaces:
SigningKeyRepository
SigningKeyRepository over the signing_keys table. Rotation is serialised across application
instances with a PostgreSQL transaction-level advisory lock.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final StringQuery returning every key, oldest first.private final org.springframework.jdbc.core.simple.JdbcClientJDBC client used to run the statements.(package private) static final longKey of the advisory lock that serialises rotations.private final SigningKeyRowMapperMaps a row to a key.private final org.springframework.transaction.support.TransactionTemplateTemplate that runs the rotation inside a transaction.private static final StringStatement inserting a key, or replacing the state of the key that has the same kid. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddeleteByKid(String kid) findAll()voidsave(SigningKey key) <T> TwithRotationLock(Supplier<T> action)
-
Field Details
-
ROTATION_LOCK_KEY
static final long ROTATION_LOCK_KEYKey of the advisory lock that serialises rotations.- See Also:
-
FIND_ALL
Query returning every key, oldest first.- See Also:
-
UPSERT
Statement inserting a key, or replacing the state of the key that has the same kid.- See Also:
-
jdbcClient
private final org.springframework.jdbc.core.simple.JdbcClient jdbcClientJDBC client used to run the statements. -
transactionTemplate
private final org.springframework.transaction.support.TransactionTemplate transactionTemplateTemplate that runs the rotation inside a transaction. -
signingKeyRowMapper
Maps a row to a key.
-
-
Constructor Details
-
JdbcSigningKeyRepository
public JdbcSigningKeyRepository()
-
-
Method Details
-
findAll
- Specified by:
findAllin interfaceSigningKeyRepository
-
save
- Specified by:
savein interfaceSigningKeyRepository
-
deleteByKid
- Specified by:
deleteByKidin interfaceSigningKeyRepository
-
withRotationLock
- Specified by:
withRotationLockin interfaceSigningKeyRepository
-