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:
  • Field Details

  • Constructor Details

    • ClientSecurityContext

      public ClientSecurityContext(String userName, Subject s)
      This creates a new ClientSecurityContext object.
      Parameters:
      The - name of the user.
      The - Credentials of the user.
  • Method Details

    • 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 interface com.sun.enterprise.security.integration.AppServSecurityContext
      Specified by:
      getCallerPrincipal in class AbstractSecurityContext
      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 interface com.sun.enterprise.security.integration.AppServSecurityContext
      Specified by:
      getSubject in class AbstractSecurityContext
      Returns:
      A credentials object associated with the current client invocation.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • 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)