public class Context
extends java.lang.Object
implements java.io.Serializable
| Constructor and Description | 
|---|
| Context()Instantiates empty context object | 
| Context(java.lang.String string)Instantiates context object containing claims from a string | 
| Context(javax.security.auth.Subject subject)Instantiates context object containing claims from a private Subject credential | 
| Modifier and Type | Method and Description | 
|---|---|
| void | addClaim(Claim claim, boolean overwrite)Populate context with the specified claim, using dictionary associated with the claim. | 
| void | addClaim(SAMLAttribute samlAttr, boolean overwrite)Populate context with a new claim created from the specified SAML Attribute, using dictionary associated with this context. | 
| void | addClaim(java.lang.String name, java.lang.String value, boolean overwrite)Populate context with a new claim created from the specified name and value, using dictionary associated with this context. | 
| Claim | getClaim(java.lang.String name)Return requested claim | 
| java.util.Iterator<Claim> | getClaims()Return an iterator to enumerate all claims in the context | 
| static ClaimDictionary | getDictionary()Return context dictionary | 
| int | getSize()Return number of claims in the context | 
| boolean | hasClaim(java.lang.String name)Validate if a given claim exists in the context | 
| boolean | isValidClaim(java.lang.String name, java.lang.String value)Validate a claim with the given name and value is legitimate. | 
| java.lang.String | showContents()For debugging purposes, dump all available claims to a String | 
| java.lang.String | toString()Convert context to a String representation in a way that can be used to instantiate Context from a String | 
| boolean | toSubject(javax.security.auth.Subject subject)Saves context as a private credential in Subject | 
public Context()
public Context(javax.security.auth.Subject subject)
        throws ContextException
subject - Subject to create context fromContextExceptionpublic Context(java.lang.String string)
        throws ContextException
stringBuffer - String buffer to create context fromContextExceptionpublic boolean toSubject(javax.security.auth.Subject subject)
subject - Subject to save context topublic java.lang.String showContents()
public java.lang.String toString()
toString in class java.lang.Objectpublic static ClaimDictionary getDictionary()
public int getSize()
public boolean hasClaim(java.lang.String name)
name - Name of the claimpublic Claim getClaim(java.lang.String name) throws UnknownClaimException
name - Name of the claimUnknownClaimExceptionpublic boolean isValidClaim(java.lang.String name,
                            java.lang.String value)
name - Name of the claimvalue - Value of the claimpublic void addClaim(java.lang.String name,
                     java.lang.String value,
                     boolean overwrite)
              throws ContextException,
                     UnknownClaimException,
                     DuplicateClaimException
name - Name of the claimvalue - Value of the claimoverwrite - If true, indicates that an existing claim with identical name should be overwrittenContextExceptionUnknownClaimExceptionDuplicateClaimExceptionpublic void addClaim(SAMLAttribute samlAttr, boolean overwrite) throws ContextException, UnknownClaimException, DuplicateClaimException
samlAttr - SAML Attributeoverwrite - If true, indicates that an existing claim with identical name should be overwrittenContextExceptionUnknownClaimExceptionDuplicateClaimExceptionpublic void addClaim(Claim claim, boolean overwrite) throws DuplicateClaimException
There is a potential for mismatch in dictionaries
claim - Claim to addoverwrite - If true, indicates that an existing claim with identical name should be overwrittenDuplicateClaimExceptionpublic java.util.Iterator<Claim> getClaims()