Class SAMLObjectSigner
java.lang.Object
se.swedenconnect.opensaml.xmlsec.signature.support.SAMLObjectSigner
Utility methods for signatures.
- Author:
- Martin Lindström (martin@idsec.se)
-
Method Summary
Modifier and TypeMethodDescriptiongetSignaturePreferences
(EntityDescriptor metadata) A recipient of a signed message may specify the signature algorithm it prefers by including the<alg:SigningMethod>
element in its metadata.static <T extends SignableSAMLObject>
voidsign
(T object, Credential signingCredentials, SignatureSigningConfiguration... configs) Signs the supplied SAML object using the supplied credentials and signature configuration(s).static <T extends SignableSAMLObject>
voidsign
(T object, Credential signingCredentials, SignatureSigningConfiguration config, EntityDescriptor recipientMetadata) Signs the supplied SAML object using the supplied credentials and signature configuration and also handles the peer signature requirements.
-
Method Details
-
sign
public static <T extends SignableSAMLObject> void sign(T object, Credential signingCredentials, SignatureSigningConfiguration... configs) throws SignatureException Signs the supplied SAML object using the supplied credentials and signature configuration(s).Note: If you have obtained the peer's prefered signature credentials, this configuration should be supplied first ...
- Type Parameters:
T
- the object type- Parameters:
object
- object to signsigningCredentials
- signature credentialsconfigs
- signature configuration- Throws:
SignatureException
- for signature creation errors
-
sign
public static <T extends SignableSAMLObject> void sign(T object, Credential signingCredentials, SignatureSigningConfiguration config, EntityDescriptor recipientMetadata) throws SignatureException Signs the supplied SAML object using the supplied credentials and signature configuration and also handles the peer signature requirements.This method corresponds to:
SignatureSigningConfiguration peerConfig = getSignaturePreferences(recipientMetadata);
followed bysign(object, signingCredentials, config, peerConfig);
. If no peer config is found, this is not passed.- Type Parameters:
T
- the object type- Parameters:
object
- object to signsigningCredentials
- signature credentialsconfig
- signature configurationrecipientMetadata
- recipient's metadata- Throws:
SignatureException
- for signature errors
-
getSignaturePreferences
A recipient of a signed message may specify the signature algorithm it prefers by including the<alg:SigningMethod>
element in its metadata. This method locates these elements, and if present, creates aSignatureSigningConfiguration
object that should be supplied tosign(SignableSAMLObject, Credential, SignatureSigningConfiguration...)
.- Parameters:
metadata
- the recipient's metadata- Returns:
- a
SignatureSigningConfiguration
element, ornull
if no preferred signing algorithms were specified
-