Class SecurityTokenManagerClient
- java.lang.Object
-
- com.sun.identity.liberty.ws.security.SecurityTokenManagerClient
-
public final class SecurityTokenManagerClient extends Object
The classSecurityTokenManagerClientis afinalclass that provides interfaces to create, get and destroyAssertions.The class provides mechanisms to manage the
Assertions either locally (i.e., within the same JVM process) or remotely on another instance of OpenAM. The default constructor will manage theAssertions locally if it detects SAML web services running locally, else will use on of the configured OpenAM. The constructor which accepts anURLwill always use the URL to manage the assertions.Having obtained an instance of
AssertionManagerClient, its methods can be called to create/getAssertion, andAssertionArtifact, and to obtain decision from anQuery.
-
-
Constructor Summary
Constructors Constructor Description SecurityTokenManagerClient(Object credential)Returns an instance ofSecurityTokenManagerClientSecurityTokenManagerClient(String url, Object credential)Returns an instance ofSecurityTokenManagerClientthat will use the providedURLfor the management of security tokens.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SecurityAssertiongetSAMLAuthenticationToken(NameIdentifier senderIdentity)Creates a SAML Assertion for message authentication.SecurityAssertiongetSAMLAuthorizationToken(NameIdentifier senderIdentity, SessionContext invocatorSession, EncryptedResourceID encResourceID, boolean includeAuthN, boolean includeResourceAccessStatement, String recipientProviderID)Creates a SAML Assertion for message authorization, the assertion could optionally contain anAuthenticationStatementwhich will be used for message authentication.SecurityAssertiongetSAMLAuthorizationToken(NameIdentifier senderIdentity, SessionContext invocatorSession, String resourceID, boolean includeAuthN, boolean includeResourceAccessStatement, String recipientProviderID)Creates a SAML Assertion for message authorization, the assertion could optionally contain anAuthenticationStatementwhich will be used for message authentication.BinarySecurityTokengetX509CertificateToken()Gets theX509certificate Token.voidsetCertAlias(String certAlias)Sets the alias of the certificate used for issuingWSStoken, i.e.voidsetCertificate(X509Certificate cert)Sets the certificate used for issuingWSStoken, i.e.
-
-
-
Constructor Detail
-
SecurityTokenManagerClient
public SecurityTokenManagerClient(Object credential) throws SecurityTokenException
Returns an instance ofSecurityTokenManagerClient- Parameters:
credential- credential of the caller used to see if access to this security token manager client is allowed.- Throws:
SecurityTokenException- if unable to access the the security token manager client.
-
SecurityTokenManagerClient
public SecurityTokenManagerClient(String url, Object credential) throws SecurityTokenException
Returns an instance ofSecurityTokenManagerClientthat will use the providedURLfor the management of security tokens.- Parameters:
url- theSecurityTokenManagerClientservice URL that will be used to getBinarySecurityTokenandSAMLSecurityToken.credential- credential of the caller used to see if access to this security token manager client is allowed.- Throws:
SecurityTokenException- if unable to access the the security token manager client.
-
-
Method Detail
-
setCertAlias
public void setCertAlias(String certAlias) throws SecurityTokenException
Sets the alias of the certificate used for issuingWSStoken, i.e.WSSX509Token,WSSSAML Token. If thecertAliasis never set, a default certificate will be used for issuingWSStokens.- Parameters:
certAlias- String alias name for the certificate.- Throws:
SecurityTokenException- if certificate for thecertAliascould not be found in key store.
-
setCertificate
public void setCertificate(X509Certificate cert) throws SecurityTokenException
Sets the certificate used for issuingWSStoken, i.e.WSSX509Token,WSSSAML Token. If the certificate is never set, a default certificate will be used for issuingWSStokens- Parameters:
cert-X509certificate- Throws:
SecurityTokenException- if could not set Certificate.
-
getX509CertificateToken
public BinarySecurityToken getX509CertificateToken() throws SecurityTokenException
Gets theX509certificate Token.- Returns:
X509certificate Token.- Throws:
SecurityTokenException- if the binary security token could not be obtained.
-
getSAMLAuthenticationToken
public SecurityAssertion getSAMLAuthenticationToken(NameIdentifier senderIdentity) throws SecurityTokenException, SAMLException
Creates a SAML Assertion for message authentication.- Parameters:
senderIdentity- name identifier of the sender.- Returns:
- Assertion which contains an
AuthenticationStatement. - Throws:
SecurityTokenException- if the assertion could not be obtained.SAMLException- if unable to generate the SAML Assertion.
-
getSAMLAuthorizationToken
public SecurityAssertion getSAMLAuthorizationToken(NameIdentifier senderIdentity, SessionContext invocatorSession, String resourceID, boolean includeAuthN, boolean includeResourceAccessStatement, String recipientProviderID) throws SecurityTokenException, SAMLException
Creates a SAML Assertion for message authorization, the assertion could optionally contain anAuthenticationStatementwhich will be used for message authentication.- Parameters:
senderIdentity- name identifier of the sender.invocatorSession-SessionContextof the invocation identity, it is normally obtained by the credential reference in the SAMLAttributeDesignatorfor discovery resource offering which is part of the libertyID-FFAuthenResponse.resourceID- id for the resource to be accessed.includeAuthN- if true, include anAutheticationStatementin the Assertion which will be used for message authentication.includeResourceAccessStatement- if true, aResourceAccessStatementwill be included in the Assertion (forAuthorizeRequesterdirective). If false, aSessionContextStatementwill be included in the Assertion (forAuthenticationSessionContextdirective). In the case when bothAuthorizeRequesterandAuthenticationSessionContextdirective need to be handled, use "true" as parameter here since theSessionContextwill always be included in theResourceAccessStatement.recipientProviderID- recipient's provider ID.- Returns:
- the
SecurityAssertionobject. - Throws:
SecurityTokenException- if the assertion could not be obtained.SAMLException- if unable to generate the SAML Assertion.
-
getSAMLAuthorizationToken
public SecurityAssertion getSAMLAuthorizationToken(NameIdentifier senderIdentity, SessionContext invocatorSession, EncryptedResourceID encResourceID, boolean includeAuthN, boolean includeResourceAccessStatement, String recipientProviderID) throws SecurityTokenException, SAMLException
Creates a SAML Assertion for message authorization, the assertion could optionally contain anAuthenticationStatementwhich will be used for message authentication.- Parameters:
senderIdentity- name identifier of the sender.invocatorSession-SessionContextof the invocation identity, it is normally obtained by the credential reference in the SAMLAttributeDesignatorfor discovery resource offering which is part of the libertyID-FFAuthenResponse.encResourceID- Encrypted ID for the resource to be accessed.includeAuthN- if true, include anAutheticationStatementin the Assertion which will be used for message authentication.includeResourceAccessStatement- if true, aResourceAccessStatementwill be included in the Assertion (forAuthorizeRequesterdirective). If false, aSessionContextStatementwill be included in the Assertion (forAuthenticationSessionContextdirective). In the case when bothAuthorizeRequesterandAuthenticationSessionContextdirective need to be handled, use "true" as parameter here since theSessionContextwill always be included in theResourceAccessStatement.recipientProviderID- recipient's provider ID.- Returns:
- the
SecurityAssertionobject. - Throws:
SecurityTokenException- if the assertion could not be obtained.SAMLException- if unable to generate the SAML Assertion.
-
-