Class AccountUtils


  • public class AccountUtils
    extends Object
    This class AccountUtils is a utility class for setting and retrieving the SAML2 account federation information.
    • Constructor Detail

      • AccountUtils

        public AccountUtils()
    • 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 - EntityID of the hosted entity.
        remoteEntityID - EntityID of 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 - NameIDInfo object 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 - NameIDInfo object.
        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.