Class SAMLObjectContentReference
- java.lang.Object
-
- org.opensaml.saml.common.SAMLObjectContentReference
-
- All Implemented Interfaces:
ConfigurableContentReference,ContentReference,TransformsConfigurableContentReference
public class SAMLObjectContentReference extends Object implements ConfigurableContentReference, TransformsConfigurableContentReference
A content reference for SAML objects that will be signed. The reference is created per the SAML specification.The default digest algorithm used is
SignatureConstants.ALGO_ID_DIGEST_SHA256.The default set of transforms applied consists of
SignatureConstants.TRANSFORM_ENVELOPED_SIGNATUREandSignatureConstants.TRANSFORM_C14N_EXCL_WITH_COMMENTS.When generating an exclusive canonicalization transform, an inclusive namespace list is generated from the namespaces, retrieved from
XMLObject.getNamespaces(), used by the SAML object to be signed and all of it's descendants.Note that the SAML specification states that: 1) an exclusive canonicalization transform (either with or without comments) SHOULD be used. 2) transforms other than enveloped signature and one of the two exclusive canonicalizations SHOULD NOT be used. Careful consideration should be made before deviating from these recommendations.
-
-
Field Summary
Fields Modifier and Type Field Description private StringdigestAlgorithmAlgorithm used to digest the content.private org.slf4j.LoggerlogClass logger.private SignableSAMLObjectsignableObjectSAMLObject this reference refers to.private List<String>transformsTransforms applied to the content.
-
Constructor Summary
Constructors Constructor Description SAMLObjectContentReference(SignableSAMLObject newSignableObject)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcreateReference(org.apache.xml.security.signature.XMLSignature signature)StringgetDigestAlgorithm().List<String>getTransforms()Gets the transforms applied to the content prior to digest generation.private voidpopulateNamespacePrefixes(Set<String> namespacePrefixes, XMLObject signatureContent)Populates the given set with the non-visibly used namespace prefixes used by the given XMLObject and all of its descendants, as determined by the signature content object's namespace manager.private voidprocessExclusiveTransform(org.apache.xml.security.signature.XMLSignature signature, org.apache.xml.security.transforms.Transform transform)Populate the inclusive namspace prefixes on the specified Apache (exclusive) transform object.voidsetDigestAlgorithm(String newAlgorithm).
-
-
-
Field Detail
-
log
@Nonnull private final org.slf4j.Logger log
Class logger.
-
signableObject
@Nonnull private final SignableSAMLObject signableObject
SAMLObject this reference refers to.
-
digestAlgorithm
@Nonnull @NotEmpty private String digestAlgorithm
Algorithm used to digest the content.
-
transforms
@Nonnull @NonnullElements private List<String> transforms
Transforms applied to the content.
-
-
Constructor Detail
-
SAMLObjectContentReference
public SAMLObjectContentReference(@Nonnull SignableSAMLObject newSignableObject)Constructor.- Parameters:
newSignableObject- the SAMLObject this reference refers to
-
-
Method Detail
-
getTransforms
@Nonnull @NonnullElements @Live public List<String> getTransforms()
Gets the transforms applied to the content prior to digest generation.- Specified by:
getTransformsin interfaceTransformsConfigurableContentReference- Returns:
- the transforms applied to the content prior to digest generation
-
getDigestAlgorithm
@Nonnull @NotEmpty public String getDigestAlgorithm()
.- Specified by:
getDigestAlgorithmin interfaceConfigurableContentReference
-
setDigestAlgorithm
public void setDigestAlgorithm(@Nonnull @NotEmpty String newAlgorithm)
.- Specified by:
setDigestAlgorithmin interfaceConfigurableContentReference
-
createReference
public void createReference(@Nonnull org.apache.xml.security.signature.XMLSignature signature)- Specified by:
createReferencein interfaceContentReference
-
processExclusiveTransform
private void processExclusiveTransform(@Nonnull org.apache.xml.security.signature.XMLSignature signature, @Nonnull org.apache.xml.security.transforms.Transform transform)Populate the inclusive namspace prefixes on the specified Apache (exclusive) transform object.- Parameters:
signature- the Apache XMLSignature objecttransform- the Apache Transform object representing an exclusive transform
-
populateNamespacePrefixes
private void populateNamespacePrefixes(@Nonnull @NonnullElements Set<String> namespacePrefixes, @Nonnull XMLObject signatureContent)
Populates the given set with the non-visibly used namespace prefixes used by the given XMLObject and all of its descendants, as determined by the signature content object's namespace manager.- Parameters:
namespacePrefixes- the namespace prefix set to be populatedsignatureContent- the XMLObject whose namespace prefixes will be used to populate the set
-
-