org.jasig.portal.portlets.swapper
Class IdentitySwapperSecurityContext

java.lang.Object
  extended by org.jasig.portal.portlets.swapper.IdentitySwapperSecurityContext
All Implemented Interfaces:
Serializable, ISecurityContext

public class IdentitySwapperSecurityContext
extends Object
implements ISecurityContext

Security context used exclusively for doing identity-swaps

Version:
$Revision$
Author:
Eric Dalquist
See Also:
Serialized Form

Constructor Summary
IdentitySwapperSecurityContext(IPrincipal principal)
           
 
Method Summary
 void addSubContext(String name, ISecurityContext ctx)
          Adds a named sub context to the list of subserviant subcontexts.
 void authenticate()
          Performs the operation of authentication.
 IAdditionalDescriptor getAdditionalDescriptor()
          Returns any additional descriptor information that might have been acquired during the process of authentication.
 int getAuthType()
          Returns the canonical authentication type for this flavor of authentication.
 IOpaqueCredentials getOpaqueCredentials()
          Returns any credentials that an authenticated principal currently has.
 IOpaqueCredentials getOpaqueCredentialsInstance()
          Returns an empty object reference to an object implementing the IOpaqueCredentials interface.
 IPrincipal getPrincipal()
          Returns the currently authenticated principal if we are currently authenticated.
 IPrincipal getPrincipalInstance()
          Returns an empty object reference to an object implementing the Principal interface.
 ISecurityContext getSubContext(String ctx)
          Returns an ISecurityContext for the named subserviant security context.
 Enumeration getSubContextNames()
          Returns an enumeration of the names of the security contexts currently registered as being subserviant to this one.
 Enumeration getSubContexts()
          Returns an enumeration of the security contexts currently registered as being subserviant to this one.
 boolean isAuthenticated()
          Returns a boolean status as to whether the descriptor corresponds to an authenticated principal.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IdentitySwapperSecurityContext

public IdentitySwapperSecurityContext(IPrincipal principal)
Method Detail

addSubContext

public void addSubContext(String name,
                          ISecurityContext ctx)
                   throws PortalSecurityException
Description copied from interface: ISecurityContext
Adds a named sub context to the list of subserviant subcontexts.

Specified by:
addSubContext in interface ISecurityContext
Parameters:
name - The non-compound name of the subserviant context. Note that under normal circumstances the establishment of the InitialSecurityContext will automatically register all subcontext.
ctx - The security context object to register.
Throws:
PortalSecurityException

authenticate

public void authenticate()
                  throws PortalSecurityException
Description copied from interface: ISecurityContext
Performs the operation of authentication. To perform this operation, the values set in the Principal object (whose reference is returned by getPrincipalInstance()) and the OpaqueCredentials object (whose reference is returned by getOpaqueCredentialsInstance()).

Specified by:
authenticate in interface ISecurityContext
Throws:
PortalSecurityException
See Also:
ISecurityContext.getPrincipalInstance(), ISecurityContext.getOpaqueCredentialsInstance()

getAdditionalDescriptor

public IAdditionalDescriptor getAdditionalDescriptor()
Description copied from interface: ISecurityContext
Returns any additional descriptor information that might have been acquired during the process of authentication. Note that this interface has no methods and the object returned will have to be cast to some concrete type or alternate interface to be useful.

Specified by:
getAdditionalDescriptor in interface ISecurityContext
Returns:
An object containing any additional descriptor information.
See Also:
IAdditionalDescriptor

getAuthType

public int getAuthType()
Description copied from interface: ISecurityContext
Returns the canonical authentication type for this flavor of authentication. Each value returned should be either a globally registered auth flavor or a local variant.

Specified by:
getAuthType in interface ISecurityContext
Returns:
The unique authentication value identifier. Values with the high order 16 bits clear are local (0x0000 - 0x00FF) where values with the high order 16 bits set (0xFF00 - 0xFFFF are foundation types distributed by JASIG. All other should be registered and globally unique.

getOpaqueCredentials

public IOpaqueCredentials getOpaqueCredentials()
Description copied from interface: ISecurityContext
Returns any credentials that an authenticated principal currently has. Note that opaque credentials don't have any methods for examination of the credentials contents. This call would primarily be useful to chain authentication manually within the same authentication schem.

Specified by:
getOpaqueCredentials in interface ISecurityContext
Returns:
The currently authenticated credentials object.
See Also:
IOpaqueCredentials

getOpaqueCredentialsInstance

public IOpaqueCredentials getOpaqueCredentialsInstance()
Description copied from interface: ISecurityContext
Returns an empty object reference to an object implementing the IOpaqueCredentials interface. By operating on this returned object the implementation class for the credentials type will be able to access any values set in the Opaque credentials without exposing an interface method that would allow others to access the fields.

Specified by:
getOpaqueCredentialsInstance in interface ISecurityContext
Returns:
An empty credentials container.
See Also:
IOpaqueCredentials

getPrincipal

public IPrincipal getPrincipal()
Description copied from interface: ISecurityContext
Returns the currently authenticated principal if we are currently authenticated. Note that merely testing this for a non-null pointer is not sufficient to verify authenticated status. The isAuthenticated() call should be used. In some authentication schemes, an asyncronous event could potentially change one's authentication status.

Specified by:
getPrincipal in interface ISecurityContext
Returns:
The currently authenticated principal.

getPrincipalInstance

public IPrincipal getPrincipalInstance()
Description copied from interface: ISecurityContext
Returns an empty object reference to an object implementing the Principal interface. By operating on this returned object the implementation class for the credentials type will be able to access any values set in the instance without exposing an interface method that would allow others (inappropriate) acces to the fields.

Specified by:
getPrincipalInstance in interface ISecurityContext
Returns:
An empty principal container.
See Also:
IPrincipal

getSubContext

public ISecurityContext getSubContext(String ctx)
                               throws PortalSecurityException
Description copied from interface: ISecurityContext
Returns an ISecurityContext for the named subserviant security context.

Specified by:
getSubContext in interface ISecurityContext
Parameters:
ctx - The non-compound name of the subserviant security context.
Returns:
The security context object reference associated with the name specified as the first parameter.
Throws:
PortalSecurityException

getSubContextNames

public Enumeration getSubContextNames()
Description copied from interface: ISecurityContext
Returns an enumeration of the names of the security contexts currently registered as being subserviant to this one.

Specified by:
getSubContextNames in interface ISecurityContext
Returns:
The enumeration object containing all of the subcontext names.

getSubContexts

public Enumeration getSubContexts()
Description copied from interface: ISecurityContext
Returns an enumeration of the security contexts currently registered as being subserviant to this one.

Specified by:
getSubContexts in interface ISecurityContext
Returns:
The enumeration object containing all of the contexts.

isAuthenticated

public boolean isAuthenticated()
Description copied from interface: ISecurityContext
Returns a boolean status as to whether the descriptor corresponds to an authenticated principal. Note that the get(Principaal|OpaqueCredentials) calls return null until isAuthenticated first returns true.

Specified by:
isAuthenticated in interface ISecurityContext


Copyright © 2010 Jasig. All Rights Reserved.