Package com.sun.identity.idm
Class IdUtils
- java.lang.Object
-
- com.sun.identity.idm.IdUtils
-
public final class IdUtils extends Object
The class defines some static utilities used by other components like policy and auth
-
-
Field Summary
Fields Modifier and Type Field Description static SetsupportedTypesprotected static MaptypesCanAddMembersprotected static MaptypesCanBeMemberOfprotected static MaptypesCanHaveMembers
-
Constructor Summary
Constructors Constructor Description IdUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static IdRepoExceptionconvertAMException(AMException ame)Returns an IdRepoException based on anAMExceptionstatic AMIdentityRepositorygetAMIdentityRepository(String orgDN)ReturnsAMIdentityRepostioryhandle for an organization.static StringgetDN(AMIdentity id)Deprecated.useIdentityUtils.getDN(AMIdentity)instead.static AMIdentitygetIdentity(SSOToken token)Returns a handle of the Identity object based on the SSO Token passed in (AMIdentityobject of the user who is authenticated).static AMIdentitygetIdentity(SSOToken token, String univId)Returns anAMIdentityobject, if provided with a string identifier for the object.static AMIdentitygetIdentity(SSOToken token, String amsdkdn, String realm)Returns anAMIdentityobject, given the DN of an authenticated identity, realm name and identity type.static AMIdentitygetIdentity(String uName, String realm)Gets the AMIdentity of a user with username equal to uName that exists in realmstatic StringgetIdentityName(String uuid, String orgName)Returns the user name extracted from the uuid if the orgName supplied in the parameter is not same realm name in uuid thenIdRepoExceptionis thrownstatic StringgetOrganization(SSOToken token, String orgIdentifier)Deprecated.UseRealmLookup.lookup(String)instead.static StringgetServiceName(IdType type)Returns the name of service which defines the profile information for this type.static IdTypegetType(String type)Returns correspondingIdTypeobject given a type.static StringgetUniversalId(AMIdentity id)Returns a string which uniquely represents this identity object.protected static voidinitialize()static booleanisOrganizationActive(SSOToken token, String realm)Deprecated.UseRealmLookup.isActive(Realm)instead.
-
-
-
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 (AMIdentityobject 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-AMIdentityobject whose string represenation is needed.- Returns:
- universal identifier of
id.
-
getIdentity
public static AMIdentity getIdentity(SSOToken token, String univId) throws IdRepoException
Returns anAMIdentityobject, if provided with a string identifier for the object.- Parameters:
token- SSOToken of the administratorunivId- 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 anAMIdentityobject, 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 administratoramsdkdn- DN of the authenticated userrealm- 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 correspondingIdTypeobject 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.useIdentityUtils.getDN(AMIdentity)instead.Returns the matching DN from the AM SDK for this entry. This utility is required by auth.- Parameters:
id-AMIdentityobject.- Returns:
DNof the object, as represented in the datastore.
-
getOrganization
@Deprecated public static String getOrganization(SSOToken token, String orgIdentifier) throws IdRepoException, SSOException
Deprecated.UseRealmLookup.lookup(String)instead.Returns an organization which maps to the identifier used by application- Parameters:
orgIdentifier- Organization identifier- Returns:
- Organization mapping to that identifier.
- Throws:
IdRepoExceptionSSOException
-
isOrganizationActive
@Deprecated public static boolean isOrganizationActive(SSOToken token, String realm) throws IdRepoException, SSOException
Deprecated.UseRealmLookup.isActive(Realm)instead.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 methodIdUtils.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:
trueif org is active; otherwisefalse- 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 anAMException- 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 thenIdRepoExceptionis thrown- Parameters:
uuid- uuid of the userorgName- 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)
ReturnsAMIdentityRepostioryhandle for an organization.- Parameters:
orgDN- the organization name.- Returns:
AMIdentityRepostioryobject
-
-