Class JdbcClientRegistrationRepository
java.lang.Object
com.irurueta.authserver.authorization.infrastructure.persistence.clients.JdbcClientRegistrationRepository
- All Implemented Interfaces:
ClientRegistrationRepository
@Repository
public class JdbcClientRegistrationRepository
extends Object
implements ClientRegistrationRepository
ClientRegistrationRepository over Spring Authorization Server's RegisteredClientRepository
(the JDBC one), which reads and writes the oauth2_registered_client table. The operations that
repository does not offer (listing, deleting, replacing a secret) run directly on that table. The conversion
between both models belongs to the RegisteredClientMapper.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final StringSub-query selecting the internal id of a client by its client id.private static final StringStatement deleting the authorizations of a client.private static final StringStatement deleting the consents granted to a client.private final org.springframework.jdbc.core.simple.JdbcClientJDBC client used for the operations the registered client repository lacks.private final RegisteredClientMapperMaps between registrations and registered clients.private final org.springframework.security.oauth2.server.authorization.client.RegisteredClientRepositoryRepository that maps registered clients to rows. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddeleteByClientId(String clientId) findAll()findByClientId(String clientId) voidsave(ClientRegistration registration, String encodedSecret) voidupdateSecret(String clientId, String encodedSecret)
-
Field Details
-
CLIENT_ROW_ID
Sub-query selecting the internal id of a client by its client id.- See Also:
-
DELETE_AUTHORIZATIONS
Statement deleting the authorizations of a client.- See Also:
-
DELETE_CONSENTS
Statement deleting the consents granted to a client.- See Also:
-
registeredClientRepository
private final org.springframework.security.oauth2.server.authorization.client.RegisteredClientRepository registeredClientRepositoryRepository that maps registered clients to rows. -
jdbcClient
private final org.springframework.jdbc.core.simple.JdbcClient jdbcClientJDBC client used for the operations the registered client repository lacks. -
registeredClientMapper
Maps between registrations and registered clients.
-
-
Constructor Details
-
JdbcClientRegistrationRepository
public JdbcClientRegistrationRepository()
-
-
Method Details
-
findByClientId
- Specified by:
findByClientIdin interfaceClientRegistrationRepository
-
findAll
- Specified by:
findAllin interfaceClientRegistrationRepository
-
save
- Specified by:
savein interfaceClientRegistrationRepository
-
deleteByClientId
The authorizations (with their consumed refresh tokens, by cascade) and the consents granted to the client reference it by its internal id without a foreign key, so they are deleted first, in the same transaction: otherwise loading one of them later fails because its client is gone. The transaction is the caller's: use cases demarcate transactions, never the adapters.
- Specified by:
deleteByClientIdin interfaceClientRegistrationRepository
-
updateSecret
- Specified by:
updateSecretin interfaceClientRegistrationRepository
-