Constructor and Description |
---|
SADValidator(EntityDescriptor idpMetadata)
Creates a SAD validator initialized with the IdP
EntityDescriptor (metadata) from which the IdP signing
key/certificate will be read (needed for JWT signature validation). |
SADValidator(se.litsec.opensaml.saml2.metadata.provider.MetadataProvider metadataProvider)
Constructor creating a SAD validator initialized with a
MetadataProvider instance. |
SADValidator(X509Certificate... certificates)
Constructor initializing the validator with a set of certificates that are to be used for JWT signature
validation.
|
Modifier and Type | Method and Description |
---|---|
SAD |
validate(AuthnRequest authnRequest,
Assertion assertion)
A method that validates the SAD issued in an
Assertion based on the AuthnRequest containing a
SADRequest . |
SAD |
validate(String sadJwt,
String idpEntityID,
String expectedRecipientEntityID,
String expectedSubject,
String expectedLoa,
String sadRequestID,
int expectedNoDocs,
String signRequestID)
Validates a SAD based on expected data.
|
void |
verifyJwtSignature(String sadJwt,
String idpEntityID)
Verifies the signature on the supplied SAD JWT.
|
public SADValidator(X509Certificate... certificates)
certificates
- certificate(s) to be used when verifying the JWT signaturepublic SADValidator(se.litsec.opensaml.saml2.metadata.provider.MetadataProvider metadataProvider)
MetadataProvider
instance. During JWT signature
validation the IdP signature certificate will be obtained from the IdP metadata entry held by the metadata
provider.metadataProvider
- metadata providerpublic SADValidator(EntityDescriptor idpMetadata)
EntityDescriptor
(metadata) from which the IdP signing
key/certificate will be read (needed for JWT signature validation).idpMetadata
- the IdP metadatapublic SAD validate(AuthnRequest authnRequest, Assertion assertion) throws SADValidationException, IllegalArgumentException
Assertion
based on the AuthnRequest
containing a
SADRequest
.authnRequest
- the AuthnRequest
holding the SADRequest
assertion
- the Assertion
holding the sad
attribute (as a encoded JWT)SAD
object, or null
if no SAD was requested (and issued)SADValidationException
- for SAD validation errorsIllegalArgumentException
- if the supplied AuthnRequest
does not contain a SADRequest
extension, or is invalid by
other means (e.g., missing LoA)validate(String, String, String, String, String, String, int, String)
public SAD validate(String sadJwt, String idpEntityID, String expectedRecipientEntityID, String expectedSubject, String expectedLoa, String sadRequestID, int expectedNoDocs, String signRequestID) throws SADValidationException
AuthnRequest
and issued Assertion
is available,
the method validate(AuthnRequest, Assertion)
is a better option.
Note: It is assumed that the supplied expectedSubject
parameter is a attribute value read from the
assertion having the attribute name indicated in the 'attr' field of the SAD. If this attribute name is not known
in advance, the SAD needs to be parsed (SADParser.parse(String)
) so that the 'attr' field can be read,
and the correct attribute value be located from the assertion.
sadJwt
- the encoded SAD JWT (found in the sad attribute of a received assertion)idpEntityID
- the entityID of the issuing IdP (the issuer of the received assertion holding the sad attribute)expectedRecipientEntityID
- the entityID of the recipient (the signature service SP that issued the SADRequest)expectedSubject
- the expected subject name (user ID). See note aboveexpectedLoa
- the expected level of assurance to be found in the SAD (should be the LoA found in the assertion)sadRequestID
- the ID of the SADRequest
extension that was sent to the IdPexpectedNoDocs
- expected number of documents (from the DocCount
element of the SADRequest
signRequestID
- ID for the SignRequest
that was included in the SADRequest
SADValidationException
- for validation errorspublic void verifyJwtSignature(String sadJwt, String idpEntityID) throws SADValidationException
sadJwt
- the SAD JWTidpEntityID
- the entityID of the IdP that signed the JWTSADValidationException
- for signature validation errorsCopyright © 2018 Litsec AB. All rights reserved.