Class CertificateController
java.lang.Object
com.irurueta.authserver.authorization.api.web.x509.CertificateController
- All Implemented Interfaces:
CertificatesApi
Manages the client certificates bound to the authenticated account (the operations of the contract). Binding and
unbinding change how the account signs in, so both call
StepUpGuard first, as unlinking an identity does.
The controller exists whether or not the sign-in with a certificate is enabled, so certificates can be bound before
it is turned on.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final BindCertificateUseCaseBinds a certificate.private final CertificateDtoMapperMaps the bindings onto the contract's DTOs.private final CurrentAccountResolverResolves the account of the request.private final ListCertificatesUseCaseLists the certificates of an account.private final PemCertificateReaderReads the certificate of a bind request.private final StepUpGuardRequires a recent multi-factor sign-in before a certificate is bound or unbound.private final UnbindCertificateUseCaseUnbinds a certificate.Fields inherited from interface com.irurueta.authserver.authorization.api.web.v1.generated.api.CertificatesApi
PATH_BIND_CERTIFICATE, PATH_LIST_CERTIFICATES, PATH_UNBIND_CERTIFICATE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.http.ResponseEntity<Certificate> bindCertificate(BindCertificateRequest request) Binds a certificate to the authenticated account.org.springframework.http.ResponseEntity<List<Certificate>> Lists the certificates bound to the authenticated account.org.springframework.http.ResponseEntity<Void> Unbinds a certificate of the authenticated account.
-
Field Details
-
currentAccountResolver
Resolves the account of the request. -
listCertificatesUseCase
Lists the certificates of an account. -
bindCertificateUseCase
Binds a certificate. -
unbindCertificateUseCase
Unbinds a certificate. -
stepUpGuard
Requires a recent multi-factor sign-in before a certificate is bound or unbound. -
pemCertificateReader
Reads the certificate of a bind request. -
certificateDtoMapper
Maps the bindings onto the contract's DTOs.
-
-
Constructor Details
-
CertificateController
public CertificateController()
-
-
Method Details
-
listCertificates
Lists the certificates bound to the authenticated account.- Specified by:
listCertificatesin interfaceCertificatesApi- Returns:
200 OKwith the certificates, possibly none.
-
bindCertificate
public org.springframework.http.ResponseEntity<Certificate> bindCertificate(BindCertificateRequest request) Binds a certificate to the authenticated account.- Specified by:
bindCertificatein interfaceCertificatesApi- Parameters:
request- the PEM certificate.- Returns:
201 Createdwith the binding.- Throws:
InvalidCertificateException- if the value is not a usable certificate.CertificateAlreadyBoundException- if the certificate is bound to another account.InsufficientUserAuthenticationException- if the account has a confirmed second factor and the token does not show a recent multi-factor sign-in.
-
unbindCertificate
Unbinds a certificate of the authenticated account.- Specified by:
unbindCertificatein interfaceCertificatesApi- Parameters:
id- identifier of the binding.- Returns:
204 No Content.- Throws:
CertificateNotFoundException- if the account has no such certificate.LastSignInMethodException- if the certificate is the last way the account can sign in.InsufficientUserAuthenticationException- if the account has a confirmed second factor and the token does not show a recent multi-factor sign-in.
-