|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.geant.edugain.validation.SAMLSigner
public class SAMLSigner
This class allows users to sign any SAML version 1.0, 1.1 and 2.0 primitive. For this class to properly work, you have to previously create an instance of Configurator class, so that you are sure eduGAIN is configured and the signature related properties loaded.
To sign a SAML (whatever version) document, follow these simple steps:
SAMLSigner signer = new SAMLSigner();
signer.sign(document);
| Field Summary | |
|---|---|
private java.security.cert.Certificate[] |
c
|
private java.lang.String |
canonicalizationalg
|
private java.util.ArrayList<java.security.cert.X509Certificate> |
certchain
|
private Configurator |
cfg
|
private org.opensaml.xml.security.x509.BasicX509Credential |
credential
|
static java.lang.String |
DEFAULT_CANONICALIZATION_ALG
|
static java.lang.String |
DEFAULT_DIGEST_ALG
|
static java.lang.String |
DEFAULT_SIGNATURE_ALG
|
private java.lang.String |
digestalg
|
private org.opensaml.xml.security.x509.X509KeyInfoGeneratorFactory |
factory
|
private java.security.Key |
key
|
private java.security.KeyStore |
keystore
|
private org.apache.log4j.Logger |
log
|
private org.opensaml.xml.io.MarshallerFactory |
mFactory
|
private java.lang.String |
signaturealg
|
| Constructor Summary | |
|---|---|
SAMLSigner()
Build a new signer with default properties. |
|
SAMLSigner(java.util.Properties properties)
Build a new signer with custom properties. |
|
| Method Summary | |
|---|---|
java.util.Collection |
getChain()
Get the certificate chain associated with the private key. |
java.lang.String |
getDigestAlgorithm()
Get the digest algorithm. |
java.security.Key |
getKey()
Get the private key in use. |
java.lang.String |
getSignatureAlgorithm()
Get the signature algorithm. |
private void |
initialize()
SAMLSigner initialization. |
void |
setDigestAlgorithm(java.lang.String algorithm)
Set the digest algorithm. |
void |
setSignatureAlgorithm(java.lang.String algorithm)
Set the signature algorithm. |
org.opensaml.SAMLSignedObject |
sign(org.opensaml.SAMLSignedObject obj)
Sign OpenSAML1 objects (SAML 1.0). |
org.opensaml.SAMLSignedObject |
sign(org.opensaml.SAMLSignedObject obj,
boolean force)
Sign OpenSAML1 objects (SAML 1.0). |
org.opensaml.common.SignableSAMLObject |
sign(org.opensaml.common.SignableSAMLObject obj)
Sign OpenSAML2 objects (including SAML 1.0, 1.1 and 2.0). |
org.opensaml.common.SignableSAMLObject |
sign(org.opensaml.common.SignableSAMLObject obj,
boolean force)
Sign OpenSAML2 objects (including SAML 1.0, 1.1 and 2.0). |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String DEFAULT_SIGNATURE_ALG
public static final java.lang.String DEFAULT_DIGEST_ALG
public static final java.lang.String DEFAULT_CANONICALIZATION_ALG
private java.security.KeyStore keystore
private java.lang.String signaturealg
private java.lang.String digestalg
private java.lang.String canonicalizationalg
private java.util.ArrayList<java.security.cert.X509Certificate> certchain
private java.security.cert.Certificate[] c
private java.security.Key key
private org.apache.log4j.Logger log
private Configurator cfg
private org.opensaml.xml.security.x509.BasicX509Credential credential
private org.opensaml.xml.io.MarshallerFactory mFactory
private org.opensaml.xml.security.x509.X509KeyInfoGeneratorFactory factory
| Constructor Detail |
|---|
public SAMLSigner(java.util.Properties properties)
throws ValidationException
properties - Properties to use.
ValidationException - Thrown if an error occurs.
public SAMLSigner()
throws ValidationException
ValidationException - Thrown if an error occurs.| Method Detail |
|---|
private void initialize()
throws ValidationException
ValidationException - Thrown if an error occurs.public java.lang.String getSignatureAlgorithm()
public void setSignatureAlgorithm(java.lang.String algorithm)
algorithm - The signature algorithm used to sign the SAMLObject.public java.lang.String getDigestAlgorithm()
public void setDigestAlgorithm(java.lang.String algorithm)
algorithm - The digest algorithm used to sign the SAMLObject.public java.security.Key getKey()
public java.util.Collection getChain()
public org.opensaml.common.SignableSAMLObject sign(org.opensaml.common.SignableSAMLObject obj)
throws ValidationException,
org.opensaml.xml.signature.SignatureException
obj - The object to be signed.
ValidationException - Thrown if an error occurs.
org.opensaml.xml.signature.SignatureException
public org.opensaml.common.SignableSAMLObject sign(org.opensaml.common.SignableSAMLObject obj,
boolean force)
throws ValidationException,
org.opensaml.xml.signature.SignatureException
obj - The object to be signed.force - Whether to force signing or not.
ValidationException - Thrown if an error occurs.
org.opensaml.xml.signature.SignatureException
public org.opensaml.SAMLSignedObject sign(org.opensaml.SAMLSignedObject obj)
throws ValidationException
obj - The object to be signed.
ValidationException - Thrown if an error occurs.
public org.opensaml.SAMLSignedObject sign(org.opensaml.SAMLSignedObject obj,
boolean force)
throws ValidationException
obj - The object to be signed.force - Whether to force signing or not.
ValidationException - Thrown if an error occurs.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||