Class PemCertificateReader
java.lang.Object
com.irurueta.authserver.authorization.api.web.x509.PemCertificateReader
Reads the certificate sent to bind it to an account: exactly one X.509 certificate in PEM form, within its validity
period, with a subject. A value that carries a private key is refused without being parsed: only the public
certificate is ever sent. The fingerprint is computed exactly as
CertificatePrincipalExtractor computes it at
sign-in, so the binding matches the certificate the browser presents later.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final StringType of the certificates.private final CertificatePrincipalExtractorComputes the fingerprint the sign-in looks up.(package private) static final intLongest subject thex509_certificatestable keeps.private static final StringMarker of a PEM private key, of any algorithm. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static X509CertificateParses exactly one X.509 certificate.Reads a certificate.
-
Field Details
-
MAX_SUBJECT_LENGTH
static final int MAX_SUBJECT_LENGTHLongest subject thex509_certificatestable keeps.- See Also:
-
CERTIFICATE_TYPE
Type of the certificates.- See Also:
-
PRIVATE_KEY_MARKER
Marker of a PEM private key, of any algorithm.- See Also:
-
fingerprints
Computes the fingerprint the sign-in looks up.
-
-
Constructor Details
-
PemCertificateReader
public PemCertificateReader()
-
-
Method Details
-
read
Reads a certificate.- Parameters:
pem- the certificate in PEM form.- Returns:
- its fingerprint and subject.
- Throws:
InvalidCertificateException- if the value carries a private key, is not exactly one X.509 certificate, is outside its validity period or has no usable subject.
-
parse
Parses exactly one X.509 certificate.- Parameters:
pem- the PEM text.- Returns:
- the certificate.
- Throws:
InvalidCertificateException- if the text is not exactly one X.509 certificate.
-