Package com.sun.identity.saml
Class AssertionManagerClient
- java.lang.Object
-
- com.sun.identity.saml.AssertionManagerClient
-
public final class AssertionManagerClient extends Object
The classAssertionManagerClientis 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 one of the configured OpenAM servers. 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 AssertionManagerClient()Default ConstructorAssertionManagerClient(String url)Constructs an instance ofAssertionManagerClientthat will use the providedURLfor the management of assertions.AssertionManagerClient(String[] urls)Constructs an instance ofAssertionManagerClientthat will use the providedURLsfor the management of assertions.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AssertioncreateAssertion(Object token)Returns an assertion that contains an authentication statement.AssertioncreateAssertion(Object token, List attributes)Returns an assertion that contains an authentication and attribute statement.AssertionArtifactcreateAssertionArtifact(Assertion assertion, String target)Returns anAssertionArtifactfor the givenAssertion.AssertiongetAssertion(AssertionIDReference idRef, Object token)Returns theAssertionbased on theAssertionIDReference.AssertiongetAssertion(AssertionIDReference idRef, String destID)Returns theAssertionbased on theAssertionIDReferenceAssertiongetAssertion(AssertionIDReference idRef, Set destID)Returns theAssertionbased on theAssertionIDReference.protected AssertiongetAssertion(AssertionArtifact artifact, String destID)Returns assertion associated with theAssertionArtifact.AssertiongetAssertion(AssertionArtifact artifact, Set destID)Returns assertion associated with theAssertionArtifact.SetgetAssertionArtifacts(Object token)Returns all validAssertionArtifactsmanaged by this instance (or the identified remote instance) of OpenAM.SetgetAssertions(Object token)Returns all validAssertions managed by this instance (or the identified remote instance) of OpenAM.
-
-
-
Constructor Detail
-
AssertionManagerClient
public AssertionManagerClient() throws SAMLExceptionDefault Constructor- Throws:
SAMLException- if it cannot be constructed.
-
AssertionManagerClient
public AssertionManagerClient(String url) throws SAMLException
Constructs an instance ofAssertionManagerClientthat will use the providedURLfor the management of assertions.- Parameters:
url-AssertionManagerservice URL that will be used to create, get and delete assertions.- Throws:
SAMLException- if it cannot be constructed.
-
AssertionManagerClient
public AssertionManagerClient(String[] urls) throws SAMLException
Constructs an instance ofAssertionManagerClientthat will use the providedURLsfor the management of assertions. In case of server failure, it will fall back to next available server.- Parameters:
urls- an array ofAssertionManagerservice URLs that will be used to create, get and delete assertions.- Throws:
SAMLException- if it cannot be constructed.
-
-
Method Detail
-
createAssertion
public Assertion createAssertion(Object token) throws SAMLException
Returns an assertion that contains an authentication statement.- Parameters:
token- User session that contains authentication information which is needed to create the authentication statement.- Returns:
- the created assertion.
- Throws:
SAMLException- if the assertion cannot be created.
-
createAssertion
public Assertion createAssertion(Object token, List attributes) throws SAMLException
Returns an assertion that contains an authentication and attribute statement.- Parameters:
token- User session that contains authentication information which is needed to create the authentication statement for the assertion.attributes- A list of attribute objects which are used to create the attribute statement.- Returns:
- The created assertion.
- Throws:
SAMLException- If the Assertion cannot be created.
-
createAssertionArtifact
public AssertionArtifact createAssertionArtifact(Assertion assertion, String target) throws SAMLException
Returns anAssertionArtifactfor the givenAssertion.- Parameters:
assertion- The Assertion for which an Artifact needs to be created.target- ThesourceIDof the site for which theAssertionArtifactis created. It is in raw String format (not Base64 encoded, for example.) This String can be obtained from converting the 20 bytes sequence to char Array, then from the char Array to String.- Returns:
AssertionArtifact- Throws:
SAMLException- if theAssertionArtifactcannot be created.
-
getAssertion
public Assertion getAssertion(AssertionIDReference idRef, Set destID) throws SAMLException
Returns theAssertionbased on theAssertionIDReference.- Parameters:
idRef- TheAssertionIDReferencewhich references to an Assertion.destID- A set of String that representing the destination site id. The destination site id requesting the assertion using the assertion id reference. This String is compared with thedestIDthat the assertion is created for originally. This field is not used (could be null) if the assertion was created without adestIDoriginally. This String can be obtained from converting the 20 byte site id sequence to char array, then a new String from the char array.- Returns:
- the Assertion referenced by the
AssertionIDReference. - Throws:
SAMLException- if an error occurred during the process; or the assertion could not be found.
-
getAssertion
public Assertion getAssertion(AssertionIDReference idRef, String destID) throws SAMLException
Returns theAssertionbased on theAssertionIDReference- Parameters:
idRef- TheAssertionIDReferencewhich references to an Assertion.destID- The destination site id requesting the assertion using the assertion id reference. This String is compared with thedestIDthat the assertion is created for originally. This field is not used (could be null) if the assertion was created without adestIDoriginally. This String can be obtained from converting the 20 byte site id sequence to char array, then a new String from the char array.- Returns:
- the Assertion referenced by the
AssertionIDReference. - Throws:
SAMLException- If an error occurred during the process; or the assertion could not be found.
-
getAssertion
public Assertion getAssertion(AssertionArtifact artifact, Set destID) throws SAMLException
Returns assertion associated with theAssertionArtifact.- Parameters:
artifact- AnAssertionArtifact.destID- A Set of String that represents the destination id. The destination site requesting the assertion using the artifact. This String is compared with thedestIDthat the artifact is created for originally. This field must not be null or empty set.- Returns:
- The Assertion referenced to by artifact.
- Throws:
SAMLException- If an error occurred during the process, or no assertion maps to the input artifact.
-
getAssertion
protected Assertion getAssertion(AssertionArtifact artifact, String destID) throws SAMLException
Returns assertion associated with theAssertionArtifact.- Parameters:
artifact- AnAssertionArtifact.destID- The destination site requesting the assertion using the artifact. This String is compared with thedestIDthat the artifact is created for originally.- Returns:
- The Assertion referenced to by artifact.
- Throws:
SAMLException- If an error occurred during the process, or no assertion maps to the input artifact.
-
getAssertion
public Assertion getAssertion(AssertionIDReference idRef, Object token) throws SAMLException
Returns theAssertionbased on theAssertionIDReference.- Parameters:
idRef- TheAssertionIDReferencewhich references to an Assertion.token- User session that is allowed to obtain the assertion. This token must have top level administrator role.- Returns:
- the Assertion referenced by the
AssertionIDReference. - Throws:
SAMLException- If an error occurred during the process; or the assertion could not be found.
-
getAssertionArtifacts
public Set getAssertionArtifacts(Object token) throws SAMLException
Returns all validAssertionArtifactsmanaged by this instance (or the identified remote instance) of OpenAM.- Parameters:
token- User session which is allowed to get allAssertionArtifacts- Returns:
- A Set of valid
AssertionArtifacts. Each element in the Set is anAssertionArtifactobject representing an artifact. - Throws:
SAMLException- If this method can not gets all validAssertionArtifacts.
-
getAssertions
public Set getAssertions(Object token) throws SAMLException
Returns all validAssertions managed by this instance (or the identified remote instance) of OpenAM.- Parameters:
token- User session which is allowed to get all Assertions.- Returns:
- A Set of valid Assertion IDs. Each element in the Set is a String representing an Assertion ID.
- Throws:
SAMLException- if this method can not gets all valid Assertions.
-
-