Package net.shibboleth.metadata.dom
Class XMLSignatureValidationStage
java.lang.Object
net.shibboleth.shared.component.AbstractInitializableComponent
net.shibboleth.shared.component.AbstractIdentifiedInitializableComponent
net.shibboleth.shared.component.AbstractIdentifiableInitializableComponent
net.shibboleth.metadata.pipeline.AbstractStage<Element>
net.shibboleth.metadata.dom.XMLSignatureValidationStage
- All Implemented Interfaces:
Stage<Element>,net.shibboleth.shared.component.Component,net.shibboleth.shared.component.DestructableComponent,net.shibboleth.shared.component.IdentifiableComponent,net.shibboleth.shared.component.IdentifiedComponent,net.shibboleth.shared.component.InitializableComponent
A pipeline stage which validates the XML digital signature found on DOM Elements.
This stage requires the following properties be set prior to initialization:
verificationKey
If Element signatures are required, per signatureRequired, and an Element does not contain a signature than
an ErrorStatus object is set on the Element.
If Element signatures are required to be valid, per isValidSignatureRequired(), and an Element signature is
found to be invalid than an ErrorStatus object is set on the element. If signatures are not required to be
valid and an Element signature is found to be invalid than an WarningStatus is set on the Element.
-
Field Summary
FieldsModifier and TypeFieldDescriptionSet of disallowed digest URIs.Set of disallowed signature method URIs.private static final org.slf4j.LoggerClass logger.private booleanOption to determine whether empty references are to be permitted.private booleanWhether Elements are required to be signed.private booleanWhether the signature on a Elements is required to be valid.private CertificateCertificate whose public key is used to verify the Element signature.private PublicKeyPublic key used to verify the Element signature. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidPerforms the stage processing on the given Item collection.protected voidGets the set of disallowed digest algorithm identifiers.Gets the set of disallowed signature method identifiers.final CertificateGets the certificate whose public key is used to verify the signed Element.final PublicKeyGets the key used to verify the signature.final booleanGets whether empty references are permitted.final booleanGets whether the Element is required to be signed.final booleanGets whether the signature on a Element element is required to be valid.voidsetDisallowedDigests(Collection<String> identifiers) Set the collection of identifiers to be disallowed as digest algorithms.voidsetDisallowedSignatureMethods(Collection<String> identifiers) Set the collection of identifiers to be disallowed as signature methods.voidsetPermittingEmptyReferences(boolean permit) Sets whether empty references are permitted.voidsetSignatureRequired(boolean required) Sets whether the Element is required to be signed.voidsetValidSignatureRequired(boolean isRequired) Sets whether the signature on a Element element is required to be valid.voidsetVerificationCertificate(Certificate certificate) Set the key, included in a certificate, used to verify the signature.voidSets the key used to verify the signature.protected voidvalidateItem(Item<Element> item, XMLSignatureValidator validator) Validate an individualItemusing the provided validator.Methods inherited from class net.shibboleth.metadata.pipeline.AbstractStage
execute, getCollectionPredicate, setCollectionPredicateMethods inherited from class net.shibboleth.shared.component.AbstractIdentifiableInitializableComponent
setIdMethods inherited from class net.shibboleth.shared.component.AbstractIdentifiedInitializableComponent
ensureId, getId, ifDestroyedThrowDestroyedComponentException, ifInitializedThrowUnmodifiabledComponentException, ifNotInitializedThrowUninitializedComponentExceptionMethods inherited from class net.shibboleth.shared.component.AbstractInitializableComponent
checkComponentActive, checkSetterPreconditions, destroy, doDestroy, initialize, isDestroyed, isInitializedMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.shibboleth.shared.component.DestructableComponent
destroy, isDestroyedMethods inherited from interface net.shibboleth.shared.component.IdentifiedComponent
getIdMethods inherited from interface net.shibboleth.shared.component.InitializableComponent
initialize, isInitialized
-
Field Details
-
LOG
@Nonnull private static final org.slf4j.Logger LOGClass logger. -
signatureRequired
private boolean signatureRequiredWhether Elements are required to be signed. -
validSignatureRequired
private boolean validSignatureRequiredWhether the signature on a Elements is required to be valid. Default value:true -
verificationCertificate
Certificate whose public key is used to verify the Element signature. -
verificationKey
Public key used to verify the Element signature. -
disallowedDigests
Set of disallowed digest URIs. Default value: empty set. -
disallowedSignatureMethods
Set of disallowed signature method URIs. Default value: empty set. -
permittingEmptyReferences
private boolean permittingEmptyReferencesOption to determine whether empty references are to be permitted. Default value:true.
-
-
Constructor Details
-
XMLSignatureValidationStage
public XMLSignatureValidationStage()
-
-
Method Details
-
isSignatureRequired
public final boolean isSignatureRequired()Gets whether the Element is required to be signed.- Returns:
- whether the Element is required to be signed
-
setSignatureRequired
public void setSignatureRequired(boolean required) Sets whether the Element is required to be signed.- Parameters:
required- whether the Element is required to be signed
-
isValidSignatureRequired
public final boolean isValidSignatureRequired()Gets whether the signature on a Element element is required to be valid.- Returns:
- whether the signature on a Element element is required to be valid
-
setValidSignatureRequired
public void setValidSignatureRequired(boolean isRequired) Sets whether the signature on a Element element is required to be valid.- Parameters:
isRequired- whether the signature on a Element element is required to be valid
-
getVerificationCertificate
Gets the certificate whose public key is used to verify the signed Element.- Returns:
- certificate whose public key is used to verify the signed Element
-
setVerificationCertificate
Set the key, included in a certificate, used to verify the signature. This method will also setverificationKeywith the public key of the certificate.- Parameters:
certificate- certificate containing the key used to verify the signature
-
getVerificationKey
Gets the key used to verify the signature.- Returns:
- key used to verify the signature
-
setVerificationKey
Sets the key used to verify the signature.- Parameters:
key- key used to verify the signature
-
setDisallowedDigests
public void setDisallowedDigests(@Nonnull @NonnullElements @Unmodifiable Collection<String> identifiers) Set the collection of identifiers to be disallowed as digest algorithms.- Parameters:
identifiers- collection of identifiers to be disallowed- Since:
- 0.10.0
-
getDisallowedDigests
Gets the set of disallowed digest algorithm identifiers.- Returns:
- the set of disallowed digest algorithm identifiers
- Since:
- 0.10.0
-
setDisallowedSignatureMethods
public void setDisallowedSignatureMethods(@Nonnull @NonnullElements @Unmodifiable Collection<String> identifiers) Set the collection of identifiers to be disallowed as signature methods.- Parameters:
identifiers- collection of identifiers to be disallowed- Since:
- 0.10.0
-
getDisallowedSignatureMethods
Gets the set of disallowed signature method identifiers.- Returns:
- the set of disallowed signature method identifiers
- Since:
- 0.10.0
-
isPermittingEmptyReferences
public final boolean isPermittingEmptyReferences()Gets whether empty references are permitted.- Returns:
- whether empty references are permitted
-
setPermittingEmptyReferences
public void setPermittingEmptyReferences(boolean permit) Sets whether empty references are permitted.- Parameters:
permit- whether empty references are permitted
-
validateItem
Validate an individualItemusing the provided validator.- Parameters:
item- theItemto validatevalidator-XMLSignatureValidatorto use for the validation
-
doExecute
Description copied from class:AbstractStagePerforms the stage processing on the given Item collection.The stage is guaranteed to be have been initialized and not destroyed when this is invoked.
- Specified by:
doExecutein classAbstractStage<Element>- Parameters:
items- collection to be processed
-
doInitialize
protected void doInitialize() throws net.shibboleth.shared.component.ComponentInitializationException- Overrides:
doInitializein classnet.shibboleth.shared.component.AbstractIdentifiedInitializableComponent- Throws:
net.shibboleth.shared.component.ComponentInitializationException
-