Class JdbcCertificateBindingRepository
java.lang.Object
com.irurueta.authserver.authorization.infrastructure.persistence.x509.JdbcCertificateBindingRepository
- All Implemented Interfaces:
CertificateBindingRepository
@Repository
public class JdbcCertificateBindingRepository
extends Object
implements CertificateBindingRepository
CertificateBindingRepository over the x509_certificates table. It joins the transaction of its
caller.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final CertificateBindingRowMapperMaps a row to a binding.private static final StringColumns selected for every query.private static final StringQuery returning the binding of a certificate.private static final StringQuery returning the bindings of an account, oldest first.private static final StringStatement storing a binding.private final org.springframework.jdbc.core.simple.JdbcClientJDBC client used to run the statements. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanDeletes a binding of an account.findByFingerprintSha256(String fingerprintSha256) Finds the binding of a certificate.findByUser(UUID userId) Lists the certificates bound to an account, oldest first.save(CertificateBinding binding) Stores a binding.
-
Field Details
-
COLUMNS
Columns selected for every query.- See Also:
-
FIND_BY_FINGERPRINT
Query returning the binding of a certificate.- See Also:
-
FIND_BY_USER
Query returning the bindings of an account, oldest first.- See Also:
-
INSERT
Statement storing a binding.- See Also:
-
jdbcClient
private final org.springframework.jdbc.core.simple.JdbcClient jdbcClientJDBC client used to run the statements. -
certificateBindingRowMapper
Maps a row to a binding.
-
-
Constructor Details
-
JdbcCertificateBindingRepository
public JdbcCertificateBindingRepository()
-
-
Method Details
-
findByFingerprintSha256
Description copied from interface:CertificateBindingRepositoryFinds the binding of a certificate.- Specified by:
findByFingerprintSha256in interfaceCertificateBindingRepository- Parameters:
fingerprintSha256- SHA-256 fingerprint of the certificate, as lower case hexadecimal digits.- Returns:
- the binding, or an empty optional when the certificate is not bound to any account.
-
findByUser
Description copied from interface:CertificateBindingRepositoryLists the certificates bound to an account, oldest first.- Specified by:
findByUserin interfaceCertificateBindingRepository- Parameters:
userId- identifier of the account.- Returns:
- the bindings, possibly empty.
-
save
Description copied from interface:CertificateBindingRepositoryStores a binding.- Specified by:
savein interfaceCertificateBindingRepository- Parameters:
binding- binding to store.- Returns:
- the stored binding.
-
delete
Description copied from interface:CertificateBindingRepositoryDeletes a binding of an account.- Specified by:
deletein interfaceCertificateBindingRepository- Parameters:
id- identifier of the binding.userId- identifier of the account, so nobody can unbind another account's certificate.- Returns:
truewhen a binding was deleted.
-