Class SAML2AssertionFactory
- java.lang.Object
-
- com.nimbusds.oauth2.sdk.assertions.saml2.SAML2AssertionFactory
-
@ThreadSafe public class SAML2AssertionFactory extends Object
Static SAML 2.0 bearer assertion factory.Related specifications:
- Assertion Framework for OAuth 2.0 Client Authentication and Authorization Grants (RFC 7521).
- Security Assertion Markup Language (SAML) 2.0 Profile for OAuth 2.0 Client Authentication and Authorization Grants (RFC 7522).
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static org.opensaml.saml.saml2.core.Assertion
create(SAML2AssertionDetails details, String xmlDsigAlg, org.opensaml.security.credential.Credential credential)
Creates a new SAML 2.0 assertion.static Element
createAsElement(SAML2AssertionDetails details, String xmlDsigAlg, org.opensaml.security.credential.Credential credential)
Creates a new SAML 2.0 assertion as an XML element.static String
createAsString(SAML2AssertionDetails details, String xmlDsigAlg, org.opensaml.security.credential.Credential credential)
Creates a new SAML 2.0 assertion as an XML string.static String
createAsString(SAML2AssertionDetails details, RSAPublicKey rsaPublicKey, RSAPrivateKey rsaPrivateKey)
Creates a new SAML 2.0 assertion as an XML string, signed with the RSA-SHA256 XML digital signature algorithm (mandatory to implement).
-
-
-
Method Detail
-
create
public static org.opensaml.saml.saml2.core.Assertion create(SAML2AssertionDetails details, String xmlDsigAlg, org.opensaml.security.credential.Credential credential)
Creates a new SAML 2.0 assertion.- Parameters:
details
- The SAML 2.0 bearer assertion details. Must not benull
.xmlDsigAlg
- The XML digital signature algorithm. Must not benull
.credential
- The appropriate credentials to facilitate signing of the assertion.- Returns:
- The SAML 2.0 bearer assertion.
- Throws:
SerializeException
- If serialisation or signing failed.
-
createAsElement
public static Element createAsElement(SAML2AssertionDetails details, String xmlDsigAlg, org.opensaml.security.credential.Credential credential)
Creates a new SAML 2.0 assertion as an XML element.- Parameters:
details
- The SAML 2.0 bearer assertion details. Must not benull
.xmlDsigAlg
- The XML digital signature algorithm. Must not benull
.credential
- The appropriate credentials to facilitate signing of the assertion.- Returns:
- The SAML 2.0 bearer assertion as an XML element.
- Throws:
SerializeException
- If serialisation or signing failed.
-
createAsString
public static String createAsString(SAML2AssertionDetails details, String xmlDsigAlg, org.opensaml.security.credential.Credential credential)
Creates a new SAML 2.0 assertion as an XML string.- Parameters:
details
- The SAML 2.0 bearer assertion details. Must not benull
.xmlDsigAlg
- The XML digital signature algorithm. Must not benull
.credential
- The appropriate credentials to facilitate signing of the assertion.- Returns:
- The SAML 2.0 bearer assertion as an XML string. Note that an XML declaration is not present in the output string.
- Throws:
SerializeException
- If serialisation or signing failed.
-
createAsString
public static String createAsString(SAML2AssertionDetails details, RSAPublicKey rsaPublicKey, RSAPrivateKey rsaPrivateKey)
Creates a new SAML 2.0 assertion as an XML string, signed with the RSA-SHA256 XML digital signature algorithm (mandatory to implement).- Parameters:
details
- The SAML 2.0 bearer assertion details. Must not benull
.rsaPublicKey
- The public RSA key. Must not benull
.rsaPrivateKey
- The private RSA key to sign the assertion. Must not benull
.- Returns:
- The SAML 2.0 bearer assertion as an XML string. Note that an XML declaration is not present in the output string.
- Throws:
SerializeException
- If serialisation or signing failed.
-
-