public abstract class BaseSAMLSimpleSignatureSecurityHandler extends AbstractMessageHandler
| Modifier and Type | Field and Description |
|---|---|
private javax.servlet.http.HttpServletRequest |
httpServletRequest
The HttpServletRequest being processed.
|
private org.slf4j.Logger |
log
Logger.
|
private SAMLPeerEntityContext |
peerContext
The context representing the SAML peer entity.
|
private SAMLProtocolContext |
samlProtocolContext
The SAML protocol context in operation.
|
private SignatureTrustEngine |
trustEngine
Signature trust engine used to validate raw signatures.
|
| Constructor and Description |
|---|
BaseSAMLSimpleSignatureSecurityHandler() |
| Modifier and Type | Method and Description |
|---|---|
protected net.shibboleth.utilities.java.support.resolver.CriteriaSet |
buildCriteriaSet(java.lang.String entityID,
MessageContext messageContext)
Build a criteria set suitable for input to the trust engine.
|
protected java.lang.String |
deriveSignerEntityID(MessageContext messageContext)
Derive the signer's entity ID from the message context.
|
private void |
doEvaluate(byte[] signature,
byte[] signedContent,
java.lang.String algorithmURI,
MessageContext messageContext)
Evaluate the simple signature based on information in the request and/or message context.
|
protected void |
doInitialize() |
protected void |
doInvoke(MessageContext messageContext)
Performs the handler logic.
|
protected boolean |
doPreInvoke(MessageContext messageContext)
Called prior to execution, handlers may override this method to perform pre-processing for a request.
|
javax.servlet.http.HttpServletRequest |
getHttpServletRequest()
Get the HTTP servlet request being processed.
|
protected java.util.List<Credential> |
getRequestCredentials(MessageContext messageContext)
Extract any candidate validation credentials from the request and/or message context.
|
protected byte[] |
getSignature()
Extract the signature value from the request, in the form suitable for input into
SignatureTrustEngine.validate(byte[], byte[], String, CriteriaSet, Credential). |
protected java.lang.String |
getSignatureAlgorithm()
Extract the signature algorithm URI value from the request.
|
protected abstract byte[] |
getSignedContent()
Get the content over which to validate the signature, in the form suitable for input into
SignatureTrustEngine.validate(byte[], byte[], String, CriteriaSet, Credential). |
protected SignatureTrustEngine |
getTrustEngine()
Gets the engine used to validate the signature.
|
protected abstract boolean |
ruleHandles(MessageContext messageContext)
Determine whether the rule should handle the request, based on the unwrapped HTTP servlet request and/or message
context.
|
void |
setHttpServletRequest(javax.servlet.http.HttpServletRequest request)
Set the HTTP servlet request being processed.
|
protected boolean |
validateSignature(byte[] signature,
byte[] signedContent,
java.lang.String algorithmURI,
net.shibboleth.utilities.java.support.resolver.CriteriaSet criteriaSet,
java.util.List<Credential> candidateCredentials)
Validate the simple signature.
|
doPostInvoke, doPostInvoke, getLogPrefix, invokedestroy, doDestroy, initialize, isDestroyed, isInitialized@Nonnull private final org.slf4j.Logger log
@NonnullAfterInit private javax.servlet.http.HttpServletRequest httpServletRequest
@Nullable private SAMLPeerEntityContext peerContext
@Nullable private SAMLProtocolContext samlProtocolContext
@Nullable private SignatureTrustEngine trustEngine
public BaseSAMLSimpleSignatureSecurityHandler()
@Nullable protected SignatureTrustEngine getTrustEngine()
@NonnullAfterInit public javax.servlet.http.HttpServletRequest getHttpServletRequest()
public void setHttpServletRequest(@Nonnull
javax.servlet.http.HttpServletRequest request)
request - The to set.protected void doInitialize()
throws net.shibboleth.utilities.java.support.component.ComponentInitializationException
doInitialize in class net.shibboleth.utilities.java.support.component.AbstractInitializableComponentnet.shibboleth.utilities.java.support.component.ComponentInitializationExceptionprotected boolean doPreInvoke(@Nonnull
MessageContext messageContext)
throws MessageHandlerException
If false is returned, execution will not proceed.
If returning successfully, the last step should be to return the result of the superclass version of this method.
doPreInvoke in class AbstractMessageHandlermessageContext - the message context on which to invoke the handlerMessageHandlerException - if there is a problem executing the handler pre-routineprotected void doInvoke(@Nonnull
MessageContext messageContext)
throws MessageHandlerException
doInvoke in class AbstractMessageHandlermessageContext - the message context on which to invoke the handlerMessageHandlerException - if there is an error invoking the handler on the message contextprivate void doEvaluate(@Nonnull @NotEmpty
byte[] signature,
@Nonnull @NotEmpty
byte[] signedContent,
@Nonnull @NotEmpty
java.lang.String algorithmURI,
@Nonnull
MessageContext messageContext)
throws MessageHandlerException
signature - the signature valuesignedContent - the content that was signedalgorithmURI - the signature algorithm URI which was used to sign the contentmessageContext - the SAML message context being processedMessageHandlerException - thrown if there are errors during the signature validation processprotected boolean validateSignature(@Nonnull @NotEmpty
byte[] signature,
@Nonnull @NotEmpty
byte[] signedContent,
@Nonnull @NotEmpty
java.lang.String algorithmURI,
@Nonnull
net.shibboleth.utilities.java.support.resolver.CriteriaSet criteriaSet,
@Nonnull @NonnullElements
java.util.List<Credential> candidateCredentials)
throws MessageHandlerException
signature - the signature valuesignedContent - the content that was signedalgorithmURI - the signature algorithm URI which was used to sign the contentcriteriaSet - criteria used to describe and/or resolve the information which serves as the basis for trust
evaluationcandidateCredentials - the request-derived candidate credential(s) containing the validation key for the
signature (optional)MessageHandlerException - thrown if there are errors during the signature validation process@Nonnull @NonnullElements protected java.util.List<Credential> getRequestCredentials(@Nonnull MessageContext messageContext) throws MessageHandlerException
messageContext - the SAML message context being processedMessageHandlerException - thrown if there is an error during request processing@Nullable
protected byte[] getSignature()
throws MessageHandlerException
SignatureTrustEngine.validate(byte[], byte[], String, CriteriaSet, Credential).
Defaults to the Base64-decoded value of the HTTP request parameter named Signature.MessageHandlerException - thrown if there is an error during request processing@Nullable
protected java.lang.String getSignatureAlgorithm()
throws MessageHandlerException
SigAlg.MessageHandlerException - thrown if there is an error during request processing@Nullable
protected java.lang.String deriveSignerEntityID(@Nonnull
MessageContext messageContext)
throws MessageHandlerException
messageContext - the SAML message context being processedMessageHandlerException - thrown if there is an error during request processing@Nonnull
protected net.shibboleth.utilities.java.support.resolver.CriteriaSet buildCriteriaSet(@Nullable
java.lang.String entityID,
@Nonnull
MessageContext messageContext)
throws MessageHandlerException
entityID - the candidate issuer entity ID which is being evaluatedmessageContext - the message context which is being evaluatedMessageHandlerException - thrown if criteria set can not be constructed@Nullable
protected abstract byte[] getSignedContent()
throws MessageHandlerException
SignatureTrustEngine.validate(byte[], byte[], String, CriteriaSet, Credential).MessageHandlerException - thrown if there is an error during request processingprotected abstract boolean ruleHandles(@Nonnull
MessageContext messageContext)
throws MessageHandlerException
messageContext - the SAML message context being processedMessageHandlerException - thrown if there is an error during request processing