Class ClientSecurityContext
- java.lang.Object
-
- com.sun.enterprise.security.common.AbstractSecurityContext
-
- com.sun.enterprise.security.common.ClientSecurityContext
-
- All Implemented Interfaces:
com.sun.enterprise.security.integration.AppServSecurityContext
,Serializable
public final class ClientSecurityContext extends AbstractSecurityContext
This class represents the security context on the client side. For usage of the IIOP_CLIENT_PER_THREAD_FLAG flag, see UsernamePasswordStore. When set to false, the volatile field sharedCsc is used to store the context.- Author:
- Harpreet Singh
- See Also:
UsernamePasswordStore
, Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static String
IIOP_CLIENT_PER_THREAD_FLAG
-
Fields inherited from class com.sun.enterprise.security.common.AbstractSecurityContext
initiator, subject
-
-
Constructor Summary
Constructors Constructor Description ClientSecurityContext(String userName, Subject s)
This creates a new ClientSecurityContext object.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Principal
getCallerPrincipal()
This method returns the caller principal.static ClientSecurityContext
getCurrent()
This method gets the SecurityContext stored here.com.sun.enterprise.security.integration.AppServSecurityContext
getCurrentSecurityContext()
Subject
getSubject()
This method should be implemented by the subclasses to return the Credentials of the caller principal.static boolean
hasEmtpyCredentials(ClientSecurityContext sc)
com.sun.enterprise.security.integration.AppServSecurityContext
newInstance(String userName, Subject subject)
com.sun.enterprise.security.integration.AppServSecurityContext
newInstance(String userName, Subject subject, String realm)
static void
setCurrent(ClientSecurityContext sc)
This method sets the SecurityContext to be stored here.void
setCurrentSecurityContext(com.sun.enterprise.security.integration.AppServSecurityContext context)
void
setSecurityContextWithPrincipal(Principal principal)
void
setUnauthenticatedSecurityContext()
String
toString()
-
-
-
Field Detail
-
IIOP_CLIENT_PER_THREAD_FLAG
public static final String IIOP_CLIENT_PER_THREAD_FLAG
- See Also:
- Constant Field Values
-
-
Method Detail
-
getCurrent
public static ClientSecurityContext getCurrent()
This method gets the SecurityContext stored here. If using a per-thread authentication model, it gets the context from Thread Local Store (TLS) of the current thread. If not using a per-thread authentication model, it gets the singleton context.- Returns:
- The current Security Context stored here. It returns null if SecurityContext could not be found.
-
setCurrent
public static void setCurrent(ClientSecurityContext sc)
This method sets the SecurityContext to be stored here.- Parameters:
The
- Security Context that should be stored.
-
getCallerPrincipal
public Principal getCallerPrincipal()
This method returns the caller principal. This information may be redundant since the same information can be inferred by inspecting the Credentials of the caller.- Specified by:
getCallerPrincipal
in interfacecom.sun.enterprise.security.integration.AppServSecurityContext
- Specified by:
getCallerPrincipal
in classAbstractSecurityContext
- Returns:
- The caller Principal.
-
getSubject
public Subject getSubject()
Description copied from class:AbstractSecurityContext
This method should be implemented by the subclasses to return the Credentials of the caller principal.- Specified by:
getSubject
in interfacecom.sun.enterprise.security.integration.AppServSecurityContext
- Specified by:
getSubject
in classAbstractSecurityContext
- Returns:
- A credentials object associated with the current client invocation.
-
hasEmtpyCredentials
public static boolean hasEmtpyCredentials(ClientSecurityContext sc)
-
newInstance
public com.sun.enterprise.security.integration.AppServSecurityContext newInstance(String userName, Subject subject, String realm)
-
newInstance
public com.sun.enterprise.security.integration.AppServSecurityContext newInstance(String userName, Subject subject)
-
setCurrentSecurityContext
public void setCurrentSecurityContext(com.sun.enterprise.security.integration.AppServSecurityContext context)
-
getCurrentSecurityContext
public com.sun.enterprise.security.integration.AppServSecurityContext getCurrentSecurityContext()
-
setUnauthenticatedSecurityContext
public void setUnauthenticatedSecurityContext()
-
setSecurityContextWithPrincipal
public void setSecurityContextWithPrincipal(Principal principal)
-
-