public class SAMLObjectContentReference extends java.lang.Object implements ConfigurableContentReference
The default digest algorithm used is SignatureConstants.ALGO_ID_DIGEST_SHA256.
The default set of transforms applied consists of SignatureConstants.TRANSFORM_ENVELOPED_SIGNATURE
and SignatureConstants.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.
| Modifier and Type | Field and Description |
|---|---|
private java.lang.String |
digestAlgorithm
Algorithm used to digest the content.
|
private org.slf4j.Logger |
log
Class logger.
|
private SignableSAMLObject |
signableObject
SAMLObject this reference refers to.
|
private java.util.List<java.lang.String> |
transforms
Transforms applied to the content.
|
| Constructor and Description |
|---|
SAMLObjectContentReference(SignableSAMLObject newSignableObject)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
createReference(org.apache.xml.security.signature.XMLSignature signature)
Called by the signature marshaller to allow references to be added to the signature.
|
java.lang.String |
getDigestAlgorithm()
Gets the algorithm used to digest the content.
|
java.util.List<java.lang.String> |
getTransforms()
Gets the transforms applied to the content prior to digest generation.
|
private void |
populateNamespacePrefixes(java.util.Set<java.lang.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 void |
processExclusiveTransform(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.
|
void |
setDigestAlgorithm(java.lang.String newAlgorithm)
Sets the algorithm used to digest the content.
|
@Nonnull private final org.slf4j.Logger log
@Nonnull private final SignableSAMLObject signableObject
@Nonnull @NotEmpty private java.lang.String digestAlgorithm
@Nonnull @NonnullElements private java.util.List<java.lang.String> transforms
public SAMLObjectContentReference(@Nonnull
SignableSAMLObject newSignableObject)
newSignableObject - the SAMLObject this reference refers to@Nonnull @NonnullElements @Live public java.util.List<java.lang.String> getTransforms()
@Nonnull @NotEmpty public java.lang.String getDigestAlgorithm()
getDigestAlgorithm in interface ConfigurableContentReferencepublic void setDigestAlgorithm(@Nonnull @NotEmpty
java.lang.String newAlgorithm)
setDigestAlgorithm in interface ConfigurableContentReferencenewAlgorithm - the algorithm used to digest the contentpublic void createReference(@Nonnull
org.apache.xml.security.signature.XMLSignature signature)
createReference in interface ContentReferencesignature - the signature objectprivate void processExclusiveTransform(@Nonnull
org.apache.xml.security.signature.XMLSignature signature,
@Nonnull
org.apache.xml.security.transforms.Transform transform)
signature - the Apache XMLSignature objecttransform - the Apache Transform object representing an exclusive transformprivate void populateNamespacePrefixes(@Nonnull @NonnullElements
java.util.Set<java.lang.String> namespacePrefixes,
@Nonnull
XMLObject signatureContent)
namespacePrefixes - the namespace prefix set to be populatedsignatureContent - the XMLObject whose namespace prefixes will be used to populate the set