Skip navigation links

Oracle Fusion Middleware Management Java API Reference for Oracle Entitlements Server
11g Release 2 (11.1.2)

E27155-03


oracle.security.idm.IdentityContext
Class Context

java.lang.Object
  extended by oracle.security.idm.IdentityContext.Context

All Implemented Interfaces:
java.io.Serializable

public class Context
extends java.lang.Object
implements java.io.Serializable

This class implements the Identity Context. The Context exposes operations on the context and enables client to write claims to and read claims from the context.

See Also:
Serialized Form

Constructor Summary
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

 

Method Summary
 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

 

Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait

 

Constructor Detail

Context

public Context()
Instantiates empty context object

Context

public Context(javax.security.auth.Subject subject)
        throws ContextException
Instantiates context object containing claims from a private Subject credential
Parameters:
subject - Subject to create context from
Throws:
ContextException

Context

public Context(java.lang.String string)
        throws ContextException
Instantiates context object containing claims from a string
Parameters:
stringBuffer - String buffer to create context from
Throws:
ContextException

Method Detail

toSubject

public boolean toSubject(javax.security.auth.Subject subject)
Saves context as a private credential in Subject
Parameters:
subject - Subject to save context to
Returns:
true if the subject did not already contain the context; false otherwise in which case the context was not saved

showContents

public java.lang.String showContents()
For debugging purposes, dump all available claims to a String
Returns:
String containing all claims in the context

toString

public java.lang.String toString()
Convert context to a String representation in a way that can be used to instantiate Context from a String
Overrides:
toString in class java.lang.Object
Returns:
String containing serialized claims in the context

getDictionary

public static ClaimDictionary getDictionary()
Return context dictionary
Returns:
Context dictionary

getSize

public int getSize()
Return number of claims in the context
Returns:
Number of claims in the context

hasClaim

public boolean hasClaim(java.lang.String name)
Validate if a given claim exists in the context
Parameters:
name - Name of the claim
Returns:
true if the claim exists in the context

getClaim

public Claim getClaim(java.lang.String name)
               throws UnknownClaimException
Return requested claim
Parameters:
name - Name of the claim
Returns:
Requested claim
Throws:
UnknownClaimException

isValidClaim

public boolean isValidClaim(java.lang.String name,
                            java.lang.String value)
Validate a claim with the given name and value is legitimate. This method doesn't return the reason for why a claim may be invalid. If its necessary to know why a claim is invalid, instantiate Claim (name, value) and catch the exception.
Parameters:
name - Name of the claim
value - Value of the claim

addClaim

public void addClaim(java.lang.String name,
                     java.lang.String value,
                     boolean overwrite)
              throws ContextException,
                     UnknownClaimException,
                     DuplicateClaimException
Populate context with a new claim created from the specified name and value, using dictionary associated with this context.
Parameters:
name - Name of the claim
value - Value of the claim
overwrite - If true, indicates that an existing claim with identical name should be overwritten
Throws:
ContextException
UnknownClaimException
DuplicateClaimException

addClaim

public void addClaim(SAMLAttribute samlAttr,
                     boolean overwrite)
              throws ContextException,
                     UnknownClaimException,
                     DuplicateClaimException
Populate context with a new claim created from the specified SAML Attribute, using dictionary associated with this context.
Parameters:
samlAttr - SAML Attribute
overwrite - If true, indicates that an existing claim with identical name should be overwritten
Throws:
ContextException
UnknownClaimException
DuplicateClaimException

addClaim

public void addClaim(Claim claim,
                     boolean overwrite)
              throws DuplicateClaimException
Populate context with the specified claim, using dictionary associated with the claim.

There is a potential for mismatch in dictionaries

Parameters:
claim - Claim to add
overwrite - If true, indicates that an existing claim with identical name should be overwritten
Throws:
DuplicateClaimException

getClaims

public java.util.Iterator<Claim> getClaims()
Return an iterator to enumerate all claims in the context
Returns:
iterator to enumerate all claims in the context

Skip navigation links

Oracle Fusion Middleware Management Java API Reference for Oracle Entitlements Server
11g Release 2 (11.1.2)

E27155-03


Copyright © 2011, 2013 Oracle. All rights reserved.