public class ResponseProcessorImpl extends Object implements ResponseProcessor
Note that initialize()
must be invoked before the bean can be used.
Modifier and Type | Field and Description |
---|---|
protected AssertionValidator |
assertionValidator
The assertion validator.
|
protected SAMLObjectDecrypter |
decrypter
The decrypter instance.
|
protected MessageReplayChecker |
messageReplayChecker
The replay checker.
|
protected MetadataCredentialResolver |
metadataCredentialResolver
Used to locate certificates from the IdP metadata.
|
protected ResponseValidationSettings |
responseValidationSettings
Static response validation settings.
|
protected ResponseValidator |
responseValidator
The response validator.
|
protected SignaturePrevalidator |
signatureProfileValidator
Validator for checking the a Signature is correct with respect to the standards.
|
protected SignatureTrustEngine |
signatureTrustEngine
The signature trust engine to be used when validating signatures.
|
Constructor and Description |
---|
ResponseProcessorImpl() |
Modifier and Type | Method and Description |
---|---|
protected AssertionValidator |
createAssertionValidator(SignatureTrustEngine signatureTrustEngine,
SignaturePrevalidator signatureProfileValidator)
Sets up the assertion validator.
|
protected ResponseValidator |
createResponseValidator(SignatureTrustEngine signatureTrustEngine,
SignaturePrevalidator signatureProfileValidator)
Sets up the response validator.
|
protected Response |
decodeResponse(String samlResponse)
Decodes the received SAML response message into a
Response object. |
void |
initialize()
Initializes the component.
|
ResponseProcessingResult |
processSamlResponse(String samlResponse,
String relayState,
ResponseProcessingInput input,
PeerMetadataResolver peerMetadataResolver,
ValidationContext validationContext)
Processes a SAML response including signature validation and assertion decryption.
|
void |
setDecrypter(SAMLObjectDecrypter decrypter)
Assigns the decrypter instance.
|
void |
setMessageReplayChecker(MessageReplayChecker messageReplayChecker)
Assigns the message replay checker to use.
|
void |
setResponseValidationSettings(ResponseValidationSettings responseValidationSettings)
Assigns the response validation settings.
|
protected void |
validateAssertion(Assertion assertion,
Response response,
ResponseProcessingInput input,
EntityDescriptor idpMetadata,
ValidationContext validationContext)
Validates the assertion.
|
protected void |
validateRelayState(Response response,
String relayState,
ResponseProcessingInput input)
Validates the received relay state matches what we sent.
|
protected void |
validateResponse(Response response,
String relayState,
ResponseProcessingInput input,
EntityDescriptor idpMetadata,
ValidationContext validationContext)
Validates the response including its signature.
|
protected SAMLObjectDecrypter decrypter
protected MessageReplayChecker messageReplayChecker
protected MetadataCredentialResolver metadataCredentialResolver
protected SignatureTrustEngine signatureTrustEngine
protected SignaturePrevalidator signatureProfileValidator
protected ResponseValidator responseValidator
protected AssertionValidator assertionValidator
protected ResponseValidationSettings responseValidationSettings
public ResponseProcessingResult processSamlResponse(String samlResponse, String relayState, ResponseProcessingInput input, PeerMetadataResolver peerMetadataResolver, ValidationContext validationContext) throws ResponseStatusErrorException, ResponseProcessingException
processSamlResponse
in interface ResponseProcessor
samlResponse
- the base64 encoded SAML responserelayState
- the received relay stateinput
- the processing inputpeerMetadataResolver
- a resolver for finding the peer metadata entryvalidationContext
- optional validation context for controlling the validation and assertion validation processResponseStatusErrorException
- if the response indicates a non-successful Status
ResponseProcessingException
- for other processing errorspublic void initialize() throws Exception
Exception
- for initialization errorsprotected ResponseValidator createResponseValidator(SignatureTrustEngine signatureTrustEngine, SignaturePrevalidator signatureProfileValidator)
The default implementation creates a ResponseValidator
instance. For use within the Swedish eID framework
subclasses should create a SwedishEidResponseValidator
instance, see the swedish-eid-opensaml library
(https://github.com/litsec/swedish-eid-opensaml).
signatureTrustEngine
- the signature trust engine to be used when validating signaturessignatureProfileValidator
- validator for checking the a Signature is correct with respect to the standardsprotected AssertionValidator createAssertionValidator(SignatureTrustEngine signatureTrustEngine, SignaturePrevalidator signatureProfileValidator)
The default implementation creates a AssertionValidator
instance. For use within the Swedish eID framework
subclasses should create a SwedishEidAssertionValidator
instance, see the swedish-eid-opensaml library
(https://github.com/litsec/swedish-eid-opensaml).
signatureTrustEngine
- the signature trust engine to be used when validating signaturessignatureProfileValidator
- validator for checking the a Signature is correct with respect to the standardsprotected Response decodeResponse(String samlResponse) throws ResponseProcessingException
Response
object.samlResponse
- the Base64 encoded SAML responseResponse
objectResponseProcessingException
- for decoding errorsprotected void validateResponse(Response response, String relayState, ResponseProcessingInput input, EntityDescriptor idpMetadata, ValidationContext validationContext) throws ResponseValidationException
response
- the response to verifyrelayState
- the relay state that was receivedinput
- the processing inputidpMetadata
- the IdP metadatavalidationContext
- optional validation contextResponseValidationException
- for validation errorsprotected void validateRelayState(Response response, String relayState, ResponseProcessingInput input) throws ResponseValidationException
response
- the responserelayState
- the received relay stateinput
- the response processing inputResponseValidationException
- for validation errorsprotected void validateAssertion(Assertion assertion, Response response, ResponseProcessingInput input, EntityDescriptor idpMetadata, ValidationContext validationContext) throws ResponseValidationException
assertion
- the assertion to validateresponse
- the response that contained the assertioninput
- the processing inputidpMetadata
- the IdP metadatvalidationContext
- optional validation contextResponseValidationException
- for validation errorspublic void setDecrypter(SAMLObjectDecrypter decrypter)
decrypter
- the decrypterpublic void setMessageReplayChecker(MessageReplayChecker messageReplayChecker)
messageReplayChecker
- message replay checkerpublic void setResponseValidationSettings(ResponseValidationSettings responseValidationSettings)
responseValidationSettings
- validation settingsCopyright © 2018 Litsec AB. All rights reserved.