org.apache.geronimo.security
Class ContextManager

java.lang.Object
  extended by org.apache.geronimo.security.ContextManager

public class ContextManager
extends Object

Version:
$Rev: 1097151 $ $Date: 2011-04-27 23:35:23 +0800 (Wed, 27 Apr 2011) $

Field Summary
static Subject EMPTY
           
static GeronimoSecurityPermission GET_CONTEXT
           
static GeronimoSecurityPermission SET_CONTEXT
           
 
Constructor Summary
ContextManager()
           
 
Method Summary
static void clearCallers()
           
static String getAlgorithm()
           
static Callers getCallers()
           
static Subject getCurrentCaller()
           
static AccessControlContext getCurrentContext()
           
static SubjectId getCurrentId()
           
static Principal getCurrentPrincipal(Subject callerSubject)
           
static Subject getNextCaller()
           
static String getPassword()
           
static Subject getRegisteredSubject(SubjectId id)
           
static SubjectId getSubjectId(Subject subject)
           
static ThreadData getThreadData()
           
static IdentificationPrincipal getThreadPrincipal()
          Obtain the thread's identifying principal.
static LoginContext login(String realm, CallbackHandler callbackHandler)
          Deprecated. use the method with Configuration
static LoginContext login(String realm, CallbackHandler callbackHandler, Configuration configuration)
           
static LoginContext login(Subject subject, String realm, CallbackHandler callbackHandler)
          Deprecated. use the method with Configuration
static LoginContext login(Subject subject, String realm, CallbackHandler callbackHandler, Configuration configuration)
           
static void logout(LoginContext loginContext)
           
static void popCallers(Callers oldCallers)
           
static Callers pushNextCaller(Subject nextCaller)
          Pusth the run-as identity as the next identity.
static SubjectId registerSubject(Subject subject)
           
static AccessControlContext registerSubjectShort(Subject subject, Principal callerPrincipal, List<String> groups)
           
static void setAlgorithm(String algorithm)
           
static void setCallers(Subject currentCaller, Subject nextCaller)
           
static Callers setNextCaller(Subject nextCaller)
           
static void setPassword(String password)
           
static void unregisterSubject(Subject subject)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

GET_CONTEXT

public static final GeronimoSecurityPermission GET_CONTEXT

SET_CONTEXT

public static final GeronimoSecurityPermission SET_CONTEXT

EMPTY

public static final Subject EMPTY
Constructor Detail

ContextManager

public ContextManager()
Method Detail

login

public static LoginContext login(String realm,
                                 CallbackHandler callbackHandler,
                                 Configuration configuration)
                          throws LoginException
Parameters:
realm -
callbackHandler -
configuration - login Configuration to use, or null for the GeronimoLoginConfiguration gbean instance
Returns:
Throws:
LoginException

login

public static LoginContext login(String realm,
                                 CallbackHandler callbackHandler)
                          throws LoginException
Deprecated. use the method with Configuration

Parameters:
realm -
callbackHandler -
Returns:
Throws:
LoginException

login

public static LoginContext login(Subject subject,
                                 String realm,
                                 CallbackHandler callbackHandler,
                                 Configuration configuration)
                          throws LoginException
Throws:
LoginException

login

public static LoginContext login(Subject subject,
                                 String realm,
                                 CallbackHandler callbackHandler)
                          throws LoginException
Deprecated. use the method with Configuration

Parameters:
subject -
realm -
callbackHandler -
Returns:
Throws:
LoginException

logout

public static void logout(LoginContext loginContext)
                   throws LoginException
Throws:
LoginException

setCallers

public static void setCallers(Subject currentCaller,
                              Subject nextCaller)

clearCallers

public static void clearCallers()

getCallers

public static Callers getCallers()

setNextCaller

public static Callers setNextCaller(Subject nextCaller)

pushNextCaller

public static Callers pushNextCaller(Subject nextCaller)
Pusth the run-as identity as the next identity. If the run-as identity is not specified, push the current identity as the next identity. Return the previous pair of current identity, next identity.

Parameters:
nextCaller - next run-as identity or null
Returns:
existing pair of (current identity, next identity)

popCallers

public static void popCallers(Callers oldCallers)

getCurrentCaller

public static Subject getCurrentCaller()

getNextCaller

public static Subject getNextCaller()

getCurrentContext

public static AccessControlContext getCurrentContext()

getCurrentPrincipal

public static Principal getCurrentPrincipal(Subject callerSubject)

getCurrentId

public static SubjectId getCurrentId()

getSubjectId

public static SubjectId getSubjectId(Subject subject)

getRegisteredSubject

public static Subject getRegisteredSubject(SubjectId id)

registerSubject

public static SubjectId registerSubject(Subject subject)

registerSubjectShort

public static AccessControlContext registerSubjectShort(Subject subject,
                                                        Principal callerPrincipal,
                                                        List<String> groups)

unregisterSubject

public static void unregisterSubject(Subject subject)

getThreadPrincipal

public static IdentificationPrincipal getThreadPrincipal()
Obtain the thread's identifying principal.

Clients should use Subject.doAs* to associate a Subject with the thread's call stack. It is this Subject that will be used for authentication checks.

Return a IdentificationPrincipal. This kind of principal is inserted into a subject if one uses one of the Geronimo LoginModules. It is a secure id that identifies the Subject.

Returns:
the principal that identifies the Subject of this thread.
See Also:
Subject.doAs(javax.security.auth.Subject, java.security.PrivilegedAction), Subject.doAs(javax.security.auth.Subject, java.security.PrivilegedExceptionAction), Subject.doAsPrivileged(javax.security.auth.Subject, java.security.PrivilegedAction, java.security.AccessControlContext), Subject.doAsPrivileged(javax.security.auth.Subject, java.security.PrivilegedExceptionAction, java.security.AccessControlContext)

getThreadData

public static ThreadData getThreadData()

getAlgorithm

public static String getAlgorithm()

setAlgorithm

public static void setAlgorithm(String algorithm)

getPassword

public static String getPassword()

setPassword

public static void setPassword(String password)


Copyright © 2003-2011 The Apache Geronimo development community. All Rights Reserved.