Class UserContext

java.lang.Object
java.rmi.server.RemoteObject
java.rmi.server.RemoteServer
java.rmi.server.UnicastRemoteObject
com.sas.services.user.UserContext
All Implemented Interfaces:
com.sas.metadata.remote.CredentialResolver, UserContextInterface, Serializable, Remote

public class UserContext extends UnicastRemoteObject implements UserContextInterface, Serializable
The UserContext provides handles to the user identities and profile services. It is basically a clearinghouse for any information that applies to a user but is not session oriented. It has a name, a set of identities (credential sets), a handle to the UserProfile, and a list of repositories the user is connected to. It also has a JAAS LoginContext and a callback handler that is used for any authentication operations requested by or for this user.
Since:
1.0
See Also:
  • Field Details

    • MIDTIERINTERNAL_DOMAIN

      public static final String MIDTIERINTERNAL_DOMAIN
      See Also:
  • Constructor Details

    • UserContext

      public UserContext(Subject subject) throws RemoteException
      Constructs a user context for the specified subject.
      Parameters:
      subject - User context's subject.
      Throws:
      RemoteException - if a networking issue is encountered.
    • UserContext

      public UserContext() throws RemoteException
      Constructs a user context which will be exported as a remote object to the RMI system using the specified client and server socket factories.
      Throws:
      RemoteException - if unable to export a remote object to the RMI system.
    • UserContext

      public UserContext(String name) throws RemoteException
      Construct a new user context with the user name.
      Parameters:
      name - The name identitfying the user.
      Throws:
      RemoteException - if a networking issue is encountered.
  • Method Details

    • getInformationService

      public static InformationServiceInterface getInformationService() throws ServiceException
      Gets a foundation Information Service.
      Returns:
      Information Service.
      Throws:
      ServiceException - if unable to obtain an information service.
    • getUserService

      public static UserServiceInterface getUserService() throws ServiceException
      Gets a foundation User Service.
      Returns:
      User Service.
      Throws:
      ServiceException - if unable to obtain a user service.
    • getUserService

      public static UserServiceInterface getUserService(String serviceId) throws ServiceException
      Throws:
      ServiceException
    • destroy

      public void destroy() throws RemoteException
      Destroy the user context. Release all resources in use.
      Specified by:
      destroy in interface UserContextInterface
      Throws:
      RemoteException - if a networking issue is encountered.
    • getName

      public String getName() throws RemoteException
      Get the user name. The name may be set by an application or by a login module, if it can determine it during the authentication process. This should be the name the user is commonly known by.

      Specified by:
      getName in interface UserContextInterface
      Returns:
      The user name.
      Throws:
      RemoteException - if a networking issue is encountered.
    • getPersonFQID

      public String getPersonFQID() throws RemoteException
      Description copied from interface: UserContextInterface
      Get the FQID of the authenticated Identity. This may actually be a Person or an IdentityGroup, if group logins are enabled.
      Specified by:
      getPersonFQID in interface UserContextInterface
      Returns:
      The FQID of the authenticated user.
      Throws:
      RemoteException - In the event of remote object failure.
    • getDescription

      public String getDescription() throws RemoteException
      Description copied from interface: UserContextInterface
      Get the common description for this user. This should come from the repository that the user's global profile is defined in. As a fallback, it will get the description from the primary authentication repository (in case they're different).
      Specified by:
      getDescription in interface UserContextInterface
      Returns:
      A String with a description of the user.
      Throws:
      RemoteException - in the event of remote object failure.
    • getAppSource

      public final String getAppSource() throws RemoteException
      Description copied from interface: UserContextInterface
      Get the name of the application that initiated the login request for this UserContext.
      Specified by:
      getAppSource in interface UserContextInterface
      Returns:
      The application source identifier.
      Throws:
      RemoteException - In the event of remote object failure.
    • getClientSource

      public final String getClientSource() throws RemoteException
      Description copied from interface: UserContextInterface
      Get the client location idetifier where the login request originated.
      Specified by:
      getClientSource in interface UserContextInterface
      Returns:
      The client identifier (usually a TCP/IP address) where the login request originated for this UserContext.
      Throws:
      RemoteException - In the event of remote object failure.
    • setAppSource

      public void setAppSource(String source) throws RemoteException
      Description copied from interface: UserContextInterface
      Set the application source identifier that initiated the logon request for this UserContext.
      Specified by:
      setAppSource in interface UserContextInterface
      Parameters:
      source - The application source that requested the creation of the UserContext. This is usualy either the main Java class name, or an identifiable application name.
      Throws:
      RemoteException - In the event of remote object failure.
    • setClientSource

      public void setClientSource(String source) throws RemoteException
      Description copied from interface: UserContextInterface
      Set the source location identifier for this UserContext.
      Specified by:
      setClientSource in interface UserContextInterface
      Parameters:
      source - The source location identifier (usually a TCP/IP address).
      Throws:
      RemoteException - In the event of remote object failure.
    • setSessionContext

      public void setSessionContext(SessionContextInterface session) throws RemoteException
      Set the session context that this user context will use for logging, etc.

      Specified by:
      setSessionContext in interface UserContextInterface
      Parameters:
      session - The session context.
      Throws:
      RemoteException - in the event of network failure.
    • getSessionContext

      public SessionContextInterface getSessionContext() throws RemoteException
      Get the session context for this user.

      Specified by:
      getSessionContext in interface UserContextInterface
      Returns:
      The session context.
      Throws:
      RemoteException - in the event of network failure.
    • setName

      public void setName(String name) throws RemoteException
      Set the user name.

      Specified by:
      setName in interface UserContextInterface
      Parameters:
      name - The new name.
      Throws:
      RemoteException - if a networking issue is encountered.
    • getKey

      public String getKey() throws RemoteException
      Get the user key. This is probably a repository ID, a UUID, or some other unique identitfier for this user. Since names aren't always unique, this is necessary to uniquely locate a user context from the user service.

      Specified by:
      getKey in interface UserContextInterface
      Returns:
      A unique identifier for this user.
      Throws:
      RemoteException - if a networking issue is encountered.
    • setKey

      public void setKey(String key) throws RemoteException
      Set the user key. This should be unique within the context of the user service. The key can only be set once. After it's set, the method will return without changing the key.

      Specified by:
      setKey in interface UserContextInterface
      Parameters:
      key - The key that identifies this user.
      Throws:
      RemoteException - if a networking issue is encountered.
    • getIDPropagation

      public String getIDPropagation() throws ServiceException, RemoteException
      Description copied from interface: UserContextInterface
      If the UserContext was authenticated using an ID propagation mechanism such as SSPI, the name of the ID propagation mechanism is returned. Otherwise, null is returned
      Specified by:
      getIDPropagation in interface UserContextInterface
      Returns:
      the name of the ID propagation mechanism used to authenticate this UserContext, if any.
      Throws:
      ServiceException - If a service level error occurs.
      RemoteException - In the event of remote object failure.
      See Also:
    • addIdentity

      public void addIdentity(UserIdentityInterface identity) throws RemoteException
      Adds a new authentication identity to this user context.

      Specified by:
      addIdentity in interface UserContextInterface
      Parameters:
      identity - The new identity to add to this context.
      Throws:
      RemoteException - if a networking issue is encountered.
    • addUserIdentityListener

      public void addUserIdentityListener(UserIdentityListener listener)
      Specified by:
      addUserIdentityListener in interface UserContextInterface
    • removeIdentity

      public void removeIdentity(UserIdentityInterface identity)
      Remove an identity from the context.
      Specified by:
      removeIdentity in interface UserContextInterface
      Parameters:
      identity - The identity to remove.
    • getIdentities

      public List getIdentities() throws RemoteException
      Get an Iterator of the identities which exist for this user context. If the current user context (set by a Subject.doAs() call) is not the same as the Subject in the LoginContext, the user has to have a CredentialPermission granted.

      Specified by:
      getIdentities in interface UserContextInterface
      Returns:
      An Iterator of UserIdentityInterface objects.
      Throws:
      RemoteException - if a networking issue is encountered.
    • getIdentityByDomain

      public UserIdentityInterface getIdentityByDomain(String domain) throws RemoteException
      Get an identity by domain.

      Specified by:
      getIdentityByDomain in interface UserContextInterface
      Parameters:
      domain - The domain to search for in the identities.
      Returns:
      An identity matching the domain requested.
      Throws:
      RemoteException - if a networking issue is encountered.
    • getIdentityByDomain

      public UserIdentityInterface getIdentityByDomain(String domain, boolean issueChallenge) throws RemoteException, ServiceException
      Get an identity by domain.

      Specified by:
      getIdentityByDomain in interface UserContextInterface
      Parameters:
      domain - The domain to search for in the identities.
      issueChallenge - If true, the callback handler set in the User Service will be used to challenge the user to provide the requested credentials.
      Returns:
      An identity matching the domain requested.
      Throws:
      RemoteException - if a networking issue is encountered.
      ServiceException - if unable to obtain the identity by domain.
    • getIdentityByDomain

      public UserIdentityInterface getIdentityByDomain(String domain, boolean issueChallenge, String prompt) throws RemoteException, ServiceException
      Gets a user identify by domain.
      Specified by:
      getIdentityByDomain in interface UserContextInterface
      Parameters:
      domain - Authentication domain
      issueChallenge - true if a challenge should be issued.
      prompt - Challenge prompt
      Returns:
      User identity or null if an idenity was not found.
      Throws:
      RemoteException - if a networking issue is encountered.
      ServiceException - if unable to obtain the identity by domain.
    • getIdentitiesByDomain

      public List getIdentitiesByDomain(String domain, boolean issueChallenge, String challengePrompt) throws RemoteException, ServiceException
      This method returns a list of all the credential sets that are available for the requested domain.
      Specified by:
      getIdentitiesByDomain in interface UserContextInterface
      Parameters:
      domain - The Authentication Domain to get credentials for.
      issueChallenge - If true, if the user currently doesn't have credentials for the requested authentication domain, a challenge is issued back to the user for them.
      challengePrompt - A string to present to the user with the challenge.
      Returns:
      A List of UserIdentityInterface objects with the credential sets for the requested domain. If no credentials for the domain exist, and none are returned from the challenge, an empty list is returned.
      Throws:
      RemoteException - In the event of remote object failure.
      ServiceException - If a service error occurs.
    • addRepositoryGroup

      public void addRepositoryGroup(RepositoryGroup group) throws ServiceException, RemoteException
      Description copied from interface: UserContextInterface
      Add a repository group to this UserContext. A repository group is a list of names of repositories to use for a search. They need not all be the same type of repository. That is, you may have OMR repositories and DAV repositories in the same group, if it makes sense to search both for some types of data. The group must have a name (non-null, and one or more characters), and must be unique for the groups managed by this UserContext. To perform a search using a group, call InformationServiceInterface.searchGroupName(UserContextInterface, String, com.sas.services.information.FilterInterface), or InformationServiceInterface.searchGroupNameWithFilterArray(UserContextInterface, String, com.sas.services.information.FilterInterface[]).
      Specified by:
      addRepositoryGroup in interface UserContextInterface
      Parameters:
      group - The repository group to add.
      Throws:
      ServiceException - If the group name is null, or if a group with the same name already exists in the UserContext.
      RemoteException - In the event of remote object failure.
    • removeRepositoryGroup

      public void removeRepositoryGroup(RepositoryGroup group) throws ServiceException, RemoteException
      Description copied from interface: UserContextInterface
      Remove a repository group from this UserContext.
      Specified by:
      removeRepositoryGroup in interface UserContextInterface
      Parameters:
      group - The Group to remove.
      Throws:
      ServiceException - If a service level error occurs.
      RemoteException - In the event of remote object failure.
    • getRepositoryGroup

      public RepositoryGroup getRepositoryGroup(String name) throws ServiceException, RemoteException
      Description copied from interface: UserContextInterface
      Specified by:
      getRepositoryGroup in interface UserContextInterface
      Parameters:
      name - The name of the group to return.
      Returns:
      The repository group specfied by name, or null if one by that name doesn't exist.
      Throws:
      ServiceException - If a service level error occurs.
      RemoteException - In the event of remote object failure.
    • getProfile

      public ProfileInterface getProfile() throws RemoteException
      Get the User's profile context.

      Specified by:
      getProfile in interface UserContextInterface
      Returns:
      The profile context for the user.
      Throws:
      RemoteException - in a networking issue is encountered.
    • addServer

      public void addServer(ServerInterface server) throws ServiceException, RemoteException
      Description copied from interface: UserContextInterface
      Add a server to the list that this user is connected to.
      Specified by:
      addServer in interface UserContextInterface
      Parameters:
      server - A server to which this user has an active connection.
      Throws:
      ServiceException - If a service level error occurs.
      RemoteException - In the event of remote object failure.
    • removeServer

      public void removeServer(ServerInterface server) throws ServiceException, RemoteException
      Description copied from interface: UserContextInterface
      Remove a server from the list that this user is currently connected to.
      Specified by:
      removeServer in interface UserContextInterface
      Parameters:
      server - The server to remove from the active list.
      Throws:
      ServiceException - If a service level error occurs.
      RemoteException - In the event of remote object failure.
    • getServer

      public ServerInterface getServer(String name) throws ServiceException, RemoteException
      Description copied from interface: UserContextInterface
      Get a specific named Information Service server from this user.
      Specified by:
      getServer in interface UserContextInterface
      Parameters:
      name - The configured name of the server to get from the connected list.
      Returns:
      The ServerInterface with the requested name, or null if it's not connected.
      Throws:
      ServiceException - If a service level error occurs.
      RemoteException - In the event of remote object failure.
    • getServers

      public List getServers() throws RemoteException
      Description copied from interface: UserContextInterface
      Get a List of the servers this user is connected to.
      Specified by:
      getServers in interface UserContextInterface
      Returns:
      A List of ServerInterface objects this user has connections to.
      Throws:
      RemoteException - In the event of remote object failure.
    • addRepository

      public void addRepository(Object repository) throws RemoteException
      Add a repository to this user context.

      Specified by:
      addRepository in interface UserContextInterface
      Parameters:
      repository - A connected repository that uses an identity for this user
      Throws:
      RemoteException - in a networking issue is encountered.
    • removeRepository

      public void removeRepository(Object repository) throws RemoteException
      Remove a repository from this context.

      Specified by:
      removeRepository in interface UserContextInterface
      Parameters:
      repository - The repository to remove from this context.
      Throws:
      RemoteException - in a networking issue is encountered.
    • getRepository

      public RepositoryInterface getRepository(String name) throws ServiceException, RemoteException
      Gets the repository for the specified name.
      Specified by:
      getRepository in interface UserContextInterface
      Parameters:
      name - Repository's name.
      Returns:
      Repository or null if a repository could not be located for the specified name.
      Throws:
      RemoteException - if a networking issue is encountered.
      ServiceException - if unable to obtain a repository.
    • getAuthRepositoryName

      public String getAuthRepositoryName() throws ServiceException, RemoteException
      Description copied from interface: UserContextInterface
      Get the Information Service configured name of the repository that was used for authentication. It's possible for a configuration to authenticate against multiple services. This will return the first server that was used to authenticate the user.
      Specified by:
      getAuthRepositoryName in interface UserContextInterface
      Returns:
      The name of the repository that was used for authentication.
      Throws:
      ServiceException - in the event of a service failure.
      RemoteException - in the event of a network failure.
    • getAuthRepository

      public RepositoryInterface getAuthRepository() throws ServiceException, RemoteException
      Description copied from interface: UserContextInterface
      Get a handle to the repository the user authenticated against. It's possible for a configuration to authenticate against multiple services. This will return the first server that was used to authenticate the user.
      Specified by:
      getAuthRepository in interface UserContextInterface
      Returns:
      The RepositoryInterface used for authentication.
      Throws:
      ServiceException - in the event of a service failure.
      RemoteException - in the event of a network failure.
    • getAuthServer

      public ServerInterface getAuthServer() throws ServiceException, RemoteException
      Description copied from interface: UserContextInterface
      Get a handle to the metadata server the user authenticated against.
      Specified by:
      getAuthServer in interface UserContextInterface
      Returns:
      The ServerInterface that the user authenticated against.
      Throws:
      ServiceException - If a server error occurs.
      RemoteException - In the event of remote object failure.
    • getAuthServerName

      public String getAuthServerName() throws ServiceException, RemoteException
      Description copied from interface: UserContextInterface
      Get the definition name of the server the user authenticated against.
      Specified by:
      getAuthServerName in interface UserContextInterface
      Returns:
      The Information Service configured Server definition name of the server that the user authenticated against.
      Throws:
      ServiceException - If a service level error occurs.
      RemoteException - In the event of remote object failure.
    • getRepositories

      public List getRepositories() throws RemoteException
      Get an iterator of the repositories this user is connected to.

      Specified by:
      getRepositories in interface UserContextInterface
      Returns:
      The connected repositories
      Throws:
      RemoteException - in a networking issue is encountered.
    • refreshRepositoryData

      public void refreshRepositoryData() throws ServiceException, RemoteException
      Description copied from interface: UserContextInterface
      Refresh all of the data that's been retrieved using the Information Service during the life of this UserContext. This is potentially a very expensive operation, so use it with care.
      Specified by:
      refreshRepositoryData in interface UserContextInterface
      Throws:
      ServiceException - If an exception occurs during the refresh operation.
      RemoteException - In the event of remote object failure.
    • equals

      public boolean equals(Object o)
      Test against another object for equality. If it's a UserContextInterface and the keys match, then they're equal.

      Overrides:
      equals in class RemoteObject
      Parameters:
      o - An object to test against this one for equality.
      Returns:
      true if the objects are equal, false otherwise.
    • getPrincipals

      public Set getPrincipals() throws RemoteException
      Gets the set of principals.
      Specified by:
      getPrincipals in interface UserContextInterface
      Returns:
      Set of principals.
      Throws:
      RemoteException - if a networking issue is encountered.
    • getPublicCredentials

      public Set getPublicCredentials() throws RemoteException
      Gets the set of public credentials.
      Specified by:
      getPublicCredentials in interface UserContextInterface
      Returns:
      Set of public credentials.
      Throws:
      RemoteException - if a networking issue is encountered.
    • getPrivateCredentials

      public Set getPrivateCredentials() throws RemoteException
      Gets the set of private credentials.
      Specified by:
      getPrivateCredentials in interface UserContextInterface
      Returns:
      Set of private credentials.
      Throws:
      RemoteException - if a networking issue is encountered.
    • getLoginCallback

      public LoginCallbackHandler getLoginCallback() throws RemoteException
      Get the callback handler. This is used by the Authenticator class to set information needed by the login modules to perform the authenticaton.
      Specified by:
      getLoginCallback in interface UserContextInterface
      Returns:
      Login callback handler.
      Throws:
      RemoteException - in a networking issue is encountered.
    • authenticate

      public boolean authenticate() throws RemoteException
      Description copied from interface: UserContextInterface
      Authenticate a user based on their current OS identity.
      Specified by:
      authenticate in interface UserContextInterface
      Returns:
      true if the authentication was successful, false otherwise.
      Throws:
      RemoteException - In the event of remote object failure.
    • authenticate

      public boolean authenticate(UserIdentityInterface ident, Map options) throws RemoteException
      Authenticates a user identity.
      Specified by:
      authenticate in interface UserContextInterface
      Parameters:
      ident - The identity to authenticate.
      options - Additional options for the authentication process (this may include a host and port for an authentication server and other information).
      Returns:
      true if the authentication was successful, false otherwise.
      Throws:
      RemoteException - in a networking issue is encountered.
    • addException

      public void addException(Exception exception) throws RemoteException
      Adds an exception.
      Specified by:
      addException in interface UserContextInterface
      Parameters:
      exception - Exception to add.
      Throws:
      RemoteException - if a networking issue is encountered.
    • clearExceptions

      public void clearExceptions() throws RemoteException
      Clears the exceptions.
      Specified by:
      clearExceptions in interface UserContextInterface
      Throws:
      RemoteException - if a networking issue is encountered.
    • getExceptions

      public Exception[] getExceptions() throws RemoteException
      Gets the exceptions.
      Specified by:
      getExceptions in interface UserContextInterface
      Returns:
      Exceptions
      Throws:
      RemoteException - if a networking issue is encountered.
    • setChallengeCallbackHandler

      public void setChallengeCallbackHandler(RemoteCallbackHandler handler) throws RemoteException
      Set the object that will be used to handle credential challenge callbacks.

      Specified by:
      setChallengeCallbackHandler in interface UserContextInterface
      Parameters:
      handler - The credential callback handler. This object will have to be an implementation of the javax.security.auth.callback.CallbackHandler interface.
      Throws:
      RemoteException - In the event of a remote failure.
    • getChallengeCallbackHandler

      public RemoteCallbackHandler getChallengeCallbackHandler() throws RemoteException
      Get the object that will handle credential challenge callbacks.

      Specified by:
      getChallengeCallbackHandler in interface UserContextInterface
      Returns:
      The callback handler
      Throws:
      RemoteException - in a networking issue is encountered.
    • getPerson

      public IdentityInterface getPerson() throws RemoteException
      Description copied from interface: UserContextInterface
      Return the IdentityInterface object that represents this user. This is the metadata object that the metadata server has determined represents the authenticated user. It may a PersonInterface or an IdentityGroupInterface object, if group logins are enabled in the UserService.
      Specified by:
      getPerson in interface UserContextInterface
      Returns:
      An IdentityInterface representing this user, or null if the authenticated user has no metadata presence (a public user).
      Throws:
      RemoteException - in the event of remote object failure.
    • setPerson

      public void setPerson(IdentityInterface identity) throws RemoteException, IllegalStateException
      This method gets called by UserService as part of the UserContext initialization. Client code should not call this method.
      Specified by:
      setPerson in interface UserContextInterface
      Parameters:
      identity - Person's identity.
      Throws:
      RemoteException - In the event of remote object failure.
      IllegalStateException - If the identity object has already been set.
    • getUniqueId

      public String getUniqueId() throws RemoteException
      Gets the unique ID associated with this user context.
      Specified by:
      getUniqueId in interface UserContextInterface
      Returns:
      User context's unique ID.
      Throws:
      RemoteException - if a network exception occurs.
    • isDestroyed

      public boolean isDestroyed() throws RemoteException
      Determines whether or not this user context has been destroyed.
      Specified by:
      isDestroyed in interface UserContextInterface
      Returns:
      true if this user context has been destroyed.
      Throws:
      RemoteException - if a network exception occurs.
    • getLoginTime

      public long getLoginTime() throws RemoteException
      Description copied from interface: UserContextInterface
      Get the timestamp when the user was authenticated.
      Specified by:
      getLoginTime in interface UserContextInterface
      Returns:
      A long representing the login date/time.
      Throws:
      RemoteException - In the event of remote object failure.
    • getSharedResource

      public Object getSharedResource(String key) throws RemoteException
      Description copied from interface: UserContextInterface
      Get an object from the shared resource map. Shared resources are generally used between repository instances, but can be shared among other objects as well.
      Specified by:
      getSharedResource in interface UserContextInterface
      Parameters:
      key - The key to the object in the resource map.
      Returns:
      The resource object, or null if nothing was found for the given key.
      Throws:
      RemoteException - In the event of remote object failure.
    • putSharedResource

      public Object putSharedResource(String key, Object value) throws RemoteException
      Description copied from interface: UserContextInterface
      Put an object into the shared resource map. This will make the object potentially available to other objects managed by the UserContext for sharing.
      Specified by:
      putSharedResource in interface UserContextInterface
      Parameters:
      key - The lookup key for the resource.
      value - The resource object to store.
      Returns:
      The old value at the resource key, or null if it's a new key.
      Throws:
      RemoteException - In the event of remote object failure.
    • toString

      public String toString()
      Overrides:
      toString in class RemoteObject
    • toByteArray

      public byte[] toByteArray() throws RemoteException
      Specified by:
      toByteArray in interface UserContextInterface
      Throws:
      RemoteException
    • getLoginConfigAppName

      protected String getLoginConfigAppName() throws ServiceException, RemoteException
      Throws:
      ServiceException
      RemoteException
    • getRoles

      public List getRoles() throws ServiceException, RemoteException
      Description copied from interface: UserContextInterface
      Get a List of the roles this user is a member of.
      Specified by:
      getRoles in interface UserContextInterface
      Returns:
      A List of Strings representing the role names this user is a member of.
      Throws:
      ServiceException - If a service level error occurs.
      RemoteException - In the event of remote object failure.
    • isInAnyRole

      public boolean isInAnyRole(List roleList) throws ServiceException, RemoteException
      Description copied from interface: UserContextInterface
      Check whether the user is a member of any of the roles in the list.
      Specified by:
      isInAnyRole in interface UserContextInterface
      Parameters:
      roleList - A List of Strings representing role names.
      Returns:
      True if the user is a member of any roles in the list. False otherwise.
      Throws:
      ServiceException - If a service level error occurs.
      RemoteException - In the event of remote object failure.
    • isInRole

      public boolean isInRole(String role) throws ServiceException, RemoteException
      Description copied from interface: UserContextInterface
      Check whether the user is a member of a given role.
      Specified by:
      isInRole in interface UserContextInterface
      Parameters:
      role - The role name to check for.
      Returns:
      True if the user is a member of the role. False otherwise.
      Throws:
      ServiceException - If a service level error occurs.
      RemoteException - In the event of remote object failure.
    • getActions

      public List getActions(String appName) throws ServiceException, RemoteException
      Description copied from interface: UserContextInterface
      Get a List of actions associated with an application that this user can perform.

      Note: UserContextInterface.getGrantedApplicationActions(String...) is recommended instead of this method.

      Specified by:
      getActions in interface UserContextInterface
      Parameters:
      appName - The SoftwareComponent name associated with the application.
      Returns:
      A List of ApplicationAuthorizations representing the actions.
      Throws:
      ServiceException - If a service level error occurs.
      RemoteException - In the event of remote object failure.
    • getActions

      public List getActions(String appName, boolean onlyGrantedActions) throws ServiceException, RemoteException
      Description copied from interface: UserContextInterface
      Get a List of actions associated with an application.

      Note: Use UserContextInterface.getGrantedApplicationActions(String...) (for granted actions) or ApplicationInterface.getActions() (for all actions) instead of this method.

      Specified by:
      getActions in interface UserContextInterface
      Parameters:
      appName - The SoftwareComponent name associated with the application.
      onlyGrantedActions - If true then return only the actions that are granted to this user; otherwise, return all actions.
      Returns:
      A List of ApplicationAuthorizations representing the actions.
      Throws:
      ServiceException - If a service level error occurs.
      RemoteException - In the event of remote object failure.
    • getGrantedApplicationActions

      public Map<String,ApplicationAuthorization> getGrantedApplicationActions(String... applicationName) throws ServiceException, RemoteException
      Description copied from interface: UserContextInterface
      Returns a map of actions granted to the user for the specified application(s). The map is keyed by application action identifier. If multiple applications are specified all applications are scanned for granted actions. If the same action identifier is defined for multiple application, only the first granted action will be returned.
      Specified by:
      getGrantedApplicationActions in interface UserContextInterface
      Parameters:
      applicationName - one or more application names
      Returns:
      a map of actions granted to the user for the specified application(s)
      Throws:
      ServiceException - If a service level error occurs.
      RemoteException - In the event of remote object failure.
    • hasCapability

      public boolean hasCapability(String appName, String action) throws ServiceException, RemoteException
      Description copied from interface: UserContextInterface
      Check whether this user has the capability to perform a specific action for a particular application.
      Specified by:
      hasCapability in interface UserContextInterface
      Parameters:
      appName - The SoftwareComponent name associated with the application.
      action - The action to perform.
      Returns:
      True if the user has permission to perform the action; otherwise, false.
      Throws:
      ServiceException - If a service level error occurs.
      RemoteException - In the event of remote object failure.
    • isInGroup

      public boolean isInGroup(String group) throws ServiceException, RemoteException
      Description copied from interface: UserContextInterface
      Check whether the user is a member of a given group.
      Specified by:
      isInGroup in interface UserContextInterface
      Parameters:
      group - The group name to check for.
      Returns:
      True if the user is a member of the group. False otherwise.
      Throws:
      ServiceException - If a service level error occurs.
      RemoteException - In the event of remote object failure.
    • isInAnyGroup

      public boolean isInAnyGroup(List groupList) throws ServiceException, RemoteException
      Description copied from interface: UserContextInterface
      Check whether the user is a member of any of the groups in the list.
      Specified by:
      isInAnyGroup in interface UserContextInterface
      Parameters:
      groupList - A List of Strings representing group names.
      Returns:
      True if the user is a member of any groups in the list. False otherwise.
      Throws:
      ServiceException - If a service level error occurs.
      RemoteException - In the event of remote object failure.
    • getGroups

      public List getGroups() throws ServiceException, RemoteException
      Description copied from interface: UserContextInterface
      Get a List of the groups this user is a member of.
      Specified by:
      getGroups in interface UserContextInterface
      Returns:
      A List of Strings representing the group names this user is a member of.
      Throws:
      ServiceException - If a service level error occurs.
      RemoteException - In the event of remote object failure.
    • requestCredentials

      public com.sas.metadata.remote.MdCredential requestCredentials(String authDomain, boolean issueChallenge, String prompt) throws RemoteException, com.sas.metadata.remote.MdException
      Specified by:
      requestCredentials in interface com.sas.metadata.remote.CredentialResolver
      Throws:
      RemoteException
      com.sas.metadata.remote.MdException
    • requestCredentialList

      public List requestCredentialList(String authDomain, boolean issueChallenge, String prompt) throws RemoteException, com.sas.metadata.remote.MdException
      Specified by:
      requestCredentialList in interface com.sas.metadata.remote.CredentialResolver
      Throws:
      RemoteException
      com.sas.metadata.remote.MdException
    • getResolvedUserId

      public final String getResolvedUserId() throws ServiceException, RemoteException
      Return the metadata server resolved user id.
      Specified by:
      getResolvedUserId in interface UserContextInterface
      Returns:
      the user id as resolved by the metadata server. This is a domain-qualified user id (e.g., user@DefaultAuth).
      Throws:
      ServiceException - If a service level error occurs.
      RemoteException - In the event of remote object failure.
    • isInternalUser

      public final boolean isInternalUser() throws ServiceException, RemoteException
      Return a boolean indicating if this user was created using an internal userid.
      Specified by:
      isInternalUser in interface UserContextInterface
      Returns:
      true if the user was created using an internal userid, false otherwise.
      Throws:
      ServiceException - If a service level error occurs.
      RemoteException - In the event of remote object failure.
    • getLocale

      public Locale getLocale() throws ServiceException, RemoteException
      Description copied from interface: UserContextInterface
      Get the locale for this user. If it has been set explicitly, return that value. If the user has a profile, return the profile setting. If there's no other locale available, return the JVM default.
      Specified by:
      getLocale in interface UserContextInterface
      Returns:
      The user's current locale setting.
      Throws:
      ServiceException - If a service level error occurs.
      RemoteException - In the event of remote object failure.
    • enableLocalAdminMode

      public void enableLocalAdminMode(String authDomain) throws ServiceException, RemoteException
      Description copied from interface: UserContextInterface
      This sets up a special case where an administrative user with an internal account is used to authenticate a user. Since the internal account cannot be used to authenticate against other resources like a workspace server, this creates a problem because the UserContext won't go get other credentials in the primary authentication domain. This overrides that behavior and makes the primary credential "sticky", so it won't really be removed if requested.
      Specified by:
      enableLocalAdminMode in interface UserContextInterface
      Parameters:
      authDomain - The domain to retrieve all credentials for. This overrides my default behavior of not getting any more credentials for the primary authentication domain.
      Throws:
      ServiceException - If a metadata or service-level error occurs.
      RemoteException - In the event of remote object failure.
    • setLocale

      public void setLocale(Locale locale) throws ServiceException, RemoteException
      Description copied from interface: UserContextInterface
      Set the locale to use for this user session.
      Specified by:
      setLocale in interface UserContextInterface
      Parameters:
      locale - The preferred locale for this user for the live of this session.
      Throws:
      ServiceException - If a service level error occurs.
      RemoteException - In the event of remote object failure.