Class FSAccountManager


  • public class FSAccountManager
    extends Object
    This class is used for storing & retrieving user account's federation specific information.
    • Method Detail

      • writeAccountFedInfo

        public void writeAccountFedInfo​(String userID,
                                        FSAccountFedInfoKey fedInfoKey,
                                        FSAccountFedInfo fedInfo)
                                 throws FSAccountMgmtException
        Stores Account's federation Info in data store.
        Parameters:
        userID - user id
        fedInfo - Account federation info as FSAccountFedInfo object.
        fedInfoKey - Account Fed Info Key which contains NameSpace and opaque handle sent/received.
        Throws:
        FSAccountMgmtException - if illegal argument passed.
      • removeAccountFedInfo

        public void removeAccountFedInfo​(String userID,
                                         FSAccountFedInfo fedInfo)
                                  throws FSAccountMgmtException
        Removes Account's federation Info in data store.
        Parameters:
        userID - user id
        fedInfo - Account federation info as FSAccountFedInfo object.
        Throws:
        FSAccountMgmtException - if illegal argument passed. TODO, this may remove the wrong info key, as two SP could federation with same IDP use the one with providerID parameter
      • writeAccountFedInfo

        public void writeAccountFedInfo​(String userID,
                                        FSAccountFedInfoKey fedInfoKey,
                                        FSAccountFedInfo fedInfo,
                                        FSAccountFedInfoKey oldFedInfoKey)
                                 throws FSAccountMgmtException
        Stores Account's federation Info in data store.
        Parameters:
        userID - user id
        fedInfo - Account federation info as FSAccountFedInfo object.
        fedInfoKey - Account Fed Info Key which contains NameSpace & opaque handle sent/received.
        oldFedInfoKey - Account Fed Info Key which contains NameSpace & opaque handle sent/received, which will be removed.
        Throws:
        FSAccountMgmtException - if illegal argument passed.
      • removeAccountFedInfoKey

        public void removeAccountFedInfoKey​(String userID,
                                            FSAccountFedInfoKey fedInfoKey)
                                     throws FSAccountMgmtException
        Removes Account's federation Info Key in data store.
        Parameters:
        userID - user id
        fedInfoKey - Account Fed Info Key which contains NameSpace & opaque handle sent/received, which will be removed.
        Throws:
        FSAccountMgmtException - if illegal argument passed.
      • removeAccountFedInfo

        public void removeAccountFedInfo​(String userID,
                                         FSAccountFedInfoKey fedInfoKey,
                                         String providerID)
                                  throws FSAccountMgmtException
        Removes Account's federation Info in data store for given providerID in fedInfo object.
        Parameters:
        userID - user id
        fedInfoKey - Account Fed Info Key which contains NameSpace & opaque handle sent/received.
        providerID - Remote ProviderID value.
        Throws:
        FSAccountMgmtException - - If Account fed info is not found for given user & given ProviderID.
      • readAccountFedInfo

        public FSAccountFedInfo readAccountFedInfo​(String userID,
                                                   String providerID)
                                            throws FSAccountMgmtException
        Reads Account's federation Info from data store for given providerID and returns value as fedInfo object. Returns null if value not found for given providerID
        Parameters:
        userID - user ID.
        providerID - Remote ProviderID value.
        Returns:
        Account's federation Info. Null if no Account Federation info value for given providerID.
        Throws:
        FSAccountMgmtException - if an error occurred.
      • readAccountFedInfo

        public FSAccountFedInfo readAccountFedInfo​(String userID,
                                                   String providerID,
                                                   String nameIDValue)
                                            throws FSAccountMgmtException
        Reads Account's federation Info from data store for given providerID and returns value as fedInfo object. Returns null if value not found for given providerID
        Parameters:
        userID - user ID.
        providerID - Remote ProviderID value.
        nameIDValue - fedinfo with this name ID value is to be found.
        Returns:
        Account's federation Info. Null if no Account Federation info value for given providerID.
        Throws:
        FSAccountMgmtException - if an error occurred.
      • readAllFederatedProviderID

        public Set readAllFederatedProviderID​(String userID)
                                       throws FSAccountMgmtException
        Reads All Account's federation Info from data store for given user identity and returns a Set of ProviderIDs with which user is federated (FedStatus is Active).
        Parameters:
        userID - user identity
        Returns:
        Set of ProviderIDs with which user is federated (FedStatus is Active).
        Throws:
        FSAccountMgmtException - if an error occurred.
      • readAllFederatedProviderID

        public Set readAllFederatedProviderID​(String providerID,
                                              String userID)
                                       throws FSAccountMgmtException
        Reads All Account's federation Info from data store for given user identity and providerID. Returns a Set of ProviderIDs with which user is federated (FedStatus is Active).
        Parameters:
        userID - user identity
        providerID - local provider ID
        Returns:
        Set of ProviderIDs with which user is federated (FedStatus is Active).
        Throws:
        FSAccountMgmtException - if error occurred.
      • isFederationActive

        public boolean isFederationActive​(String userID,
                                          String providerID)
                                   throws FSAccountMgmtException
        Returns true/false if Account's federation Status is Active / Inactive for given providerID.
        Parameters:
        userID - user identity
        providerID - Remote ProviderID value.
        Returns:
        true/false if Account's federation Status is Active / Inactive for given providerID.
        Throws:
        FSAccountMgmtException - - If Account fed info is not found for given user & given ProviderID.
      • hasAnyActiveFederation

        public boolean hasAnyActiveFederation​(String userID)
                                       throws FSAccountMgmtException
        Returns true If Any Active federation is found where idpRole is true means local deployment worked as SP in that federation and federation is still Active.
        Parameters:
        userID - user id
        Returns:
        true If Any Active federation is found where idpRole is true means local deployment worked as SP in that federation and federation is still Active.
        Throws:
        FSAccountMgmtException - - If Account fed info is not found for given user.
      • getUserID

        public String getUserID​(FSAccountFedInfoKey fedInfoKey,
                                Map env)
                         throws FSAccountMgmtException
        Searches user with given combination of ProviderID & Opaque handle in Default Organization.
        Parameters:
        fedInfoKey - Account Fed Info Key which contains NameSpace & opaque handle sent/received.
        env - - Extra parameters that can be used for user mapping.
        Returns:
        User DN if user found with given combination else returns null. If Some error occurs returns null.
        Throws:
        FSAccountMgmtException - - If Unable to get Organization
      • getUserID

        public String getUserID​(FSAccountFedInfoKey fedInfoKey,
                                String orgDN,
                                Map env)
                         throws FSAccountMgmtException
        Searches user with given combination of ProviderID & Opaque handle in given Organization.
        Parameters:
        fedInfoKey - Account Fed Info Key which contains NameSpace & opaque handle sent/received.
        orgDN - organization DN.
        env - Extra parameters that can be used for user mapping.
        Returns:
        User DN if user found with given combination else returns null. If Some error occurs returns null.
        Throws:
        FSAccountMgmtException - - If Unable to get Organization.
      • getUserID

        public String getUserID​(Map avPair,
                                String orgDN,
                                Map env)
                         throws FSAccountMgmtException
        Gets the user by using a given search filter.
        Parameters:
        avPair - Attribute Value Pair to be used in finding the user.
        orgDN - Organization DN.
        env - Extra parameters that can be used for user mapping.
        Throws:
        FSAccountMgmtException - if an error occurred.