Class IdUtils


  • public final class IdUtils
    extends Object
    The class defines some static utilities used by other components like policy and auth
    • Field Detail

      • supportedTypes

        public static Set supportedTypes
      • typesCanBeMemberOf

        protected static Map typesCanBeMemberOf
      • typesCanHaveMembers

        protected static Map typesCanHaveMembers
      • typesCanAddMembers

        protected static Map typesCanAddMembers
    • Constructor Detail

      • IdUtils

        public IdUtils()
    • Method Detail

      • initialize

        protected static void initialize()
      • getIdentity

        public static AMIdentity getIdentity​(SSOToken token)
                                      throws IdRepoException,
                                             SSOException
        Returns a handle of the Identity object based on the SSO Token passed in (AMIdentity object of the user who is authenticated).
        Parameters:
        token - Single sign on token of user.
        Returns:
        Identity object.
        Throws:
        IdRepoException - if there are repository related error conditions.
        SSOException - if user's single sign on token is invalid.
      • getUniversalId

        public static String getUniversalId​(AMIdentity id)
        Returns a string which uniquely represents this identity object.
        Parameters:
        id - AMIdentity object whose string represenation is needed.
        Returns:
        universal identifier of id.
      • getIdentity

        public static AMIdentity getIdentity​(SSOToken token,
                                             String univId)
                                      throws IdRepoException
        Returns an AMIdentity object, if provided with a string identifier for the object.
        Parameters:
        token - SSOToken of the administrator
        univId - String represenation of the identity.
        Returns:
        Identity object
        Throws:
        IdRepoException - if the identifier provided is wrong.
      • getIdentity

        public static AMIdentity getIdentity​(SSOToken token,
                                             String amsdkdn,
                                             String realm)
                                      throws IdRepoException
        Returns an AMIdentity object, given the DN of an authenticated identity, realm name and identity type. This interface is mainly for authentication component to get back the identity of the user.
        Parameters:
        token - SSOToken of the administrator
        amsdkdn - DN of the authenticated user
        realm - realm name where the user was authenticated
        Returns:
        Identity object or null
        Throws:
        IdRepoException - if the underly components throws exception while obtaining the identity object
      • getServiceName

        public static String getServiceName​(IdType type)
        Returns the name of service which defines the profile information for this type. Returns null, if nothing is defined.
        Parameters:
        type - IdType whose service name is needed.
        Returns:
        Name of the service.
      • getType

        public static IdType getType​(String type)
                              throws IdRepoException
        Returns corresponding IdType object given a type.
        Parameters:
        type - of object to return.
        Returns:
        Idtype of type.
        Throws:
        IdRepoException - if there are no corresponding types.
      • getDN

        @Deprecated
        public static String getDN​(AMIdentity id)
        Deprecated.
        Returns the matching DN from the AM SDK for this entry. This utility is required by auth.
        Parameters:
        id - AMIdentity object.
        Returns:
        DN of the object, as represented in the datastore.
      • isOrganizationActive

        @Deprecated
        public static boolean isOrganizationActive​(SSOToken token,
                                                   String realm)
                                            throws IdRepoException,
                                                   SSOException
        Deprecated.
        Returs true or false, depending on if this organization is enabled or not. The organization string passed to this method should be an identifier returned from the method IdUtils.getOrganization . In the default mode, where relams are enabled but backward comaptibility is required, this checks for organization status in the AM enabled Sun DS. Otherwise, it checks for organization status from the realms tree.
        Parameters:
        token - token SSOToken a valid SSOToken.
        realm - name of the organization of interest.
        Returns:
        true if org is active; otherwise false
        Throws:
        IdRepoException - if there are repository related error conditions.
        SSOException - If user's single sign on token is invalid.
      • convertAMException

        public static IdRepoException convertAMException​(AMException ame)
        Returns an IdRepoException based on an AMException
        Parameters:
        ame -
        Returns:
        IdRepoException based on ame.
      • getIdentityName

        public static String getIdentityName​(String uuid,
                                             String orgName)
                                      throws IdRepoException
        Returns the user name extracted from the uuid if the orgName supplied in the parameter is not same realm name in uuid then IdRepoException is thrown
        Parameters:
        uuid - uuid of the user
        orgName - the org user is trying to login to
        Returns:
        user name
        Throws:
        IdRepoException
      • getIdentity

        public static AMIdentity getIdentity​(String uName,
                                             String realm)
        Gets the AMIdentity of a user with username equal to uName that exists in realm
        Parameters:
        uName - username of the user to get.
        realm - realm the user belongs to.
        Returns:
        The AMIdentity of user with username equal to uName.
      • getAMIdentityRepository

        public static AMIdentityRepository getAMIdentityRepository​(String orgDN)
        Returns AMIdentityRepostiory handle for an organization.
        Parameters:
        orgDN - the organization name.
        Returns:
        AMIdentityRepostiory object