Package com.sun.identity.saml2.common
Class AccountUtils
- java.lang.Object
-
- com.sun.identity.saml2.common.AccountUtils
-
public class AccountUtils extends Object
This classAccountUtilsis a utility class for setting and retrieving theSAML2account federation information.
-
-
Constructor Summary
Constructors Constructor Description AccountUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Map<String,Set<String>>convertToAttributes(NameIDInfo info, NameIDInfoKey infoKey)Converts the provided NameIDInfo and NameIDInfoKey to a Map<String, Set<String>> structure.static NameIDInfogetAccountFederation(String userID, String hostEntityID, String remoteEntityID)Returns the account federation information of a user for the given identity provider and a service provider.static StringgetNameIDInfoAttribute()Returns the SAML2 Name Identifier Info attribute name.static StringgetNameIDInfoKeyAttribute()Returns the SAML2 Name Identifier InfoKey attribute name.static booleanremoveAccountFederation(NameIDInfo info, String userID)Removes the account federation of a user.static voidsetAccountFederation(NameIDInfo info, String userID)Sets the account federation information to the datastore for a user.
-
-
-
Method Detail
-
getAccountFederation
public static NameIDInfo getAccountFederation(String userID, String hostEntityID, String remoteEntityID) throws SAML2Exception
Returns the account federation information of a user for the given identity provider and a service provider.- Parameters:
userID- user id for which account federation needs to be returned.hostEntityID-EntityIDof the hosted entity.remoteEntityID-EntityIDof the remote entity.- Returns:
- the account federation info object. null if the account federation does not exist.
- Throws:
SAML2Exception- if account federation retrieval is failed.
-
setAccountFederation
public static void setAccountFederation(NameIDInfo info, String userID) throws SAML2Exception
Sets the account federation information to the datastore for a user.- Parameters:
info-NameIDInfoobject to be set.userID- user identifier for which the account federation to be set.- Throws:
SAML2Exception- if any failure.
-
convertToAttributes
public static Map<String,Set<String>> convertToAttributes(NameIDInfo info, NameIDInfoKey infoKey) throws SAML2Exception
Converts the provided NameIDInfo and NameIDInfoKey to a Map<String, Set<String>> structure.- Parameters:
info- The NameIDInfo.infoKey- The NameIDInfoKey.- Returns:
- An attribute map containing the serialized NameID data.
- Throws:
SAML2Exception- If there was a problem whilst creating NameIDInfoKey.
-
removeAccountFederation
public static boolean removeAccountFederation(NameIDInfo info, String userID) throws SAML2Exception
Removes the account federation of a user.- Parameters:
info-NameIDInfoobject.userID- user identifie for which the account federation needs to be removed.- Returns:
- true if the account federation is removed successfully.
- Throws:
SAML2Exception- if any failure.
-
getNameIDInfoAttribute
public static String getNameIDInfoAttribute()
Returns the SAML2 Name Identifier Info attribute name.- Returns:
- the SAML2 Name Identifier Info attribute name.
-
getNameIDInfoKeyAttribute
public static String getNameIDInfoKeyAttribute()
Returns the SAML2 Name Identifier InfoKey attribute name.- Returns:
- the SAML2 Name Identifier InfoKey attribute name.
-
-