Class AllowedAccounts

  • All Implemented Interfaces:

    
    public final class AllowedAccounts
    
                        

    Allows an app to find out whether the accounts allowed to be signed in are restricted and if so which accounts are allowed. The MAM SDK provides this, information but it does not perform any enforcement. If accounts are restricted, it is the app's responsibility to allow only the allowed accounts to sign in and to remove any accounts which are not in the allowed set. Allowed accounts are identified by UPN, and in most cases by AAD user id.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      static List<AllowedAccountInfo> getAllowedAccounts() Returns the list of allowed accounts or null if restrictions are not in place.
      static boolean isAccountAllowed(@NonNull() String upnOrAADId) Check if the given UPN or AAD user id (both case-insensitive) is allowed to sign in.
      static void listenForChanges(@NonNull() AllowedAccountsListener listener) Listen for changed to the allowed account list.
      static void unregisterListener(@NonNull() AllowedAccountsListener listener) Unregister a listener previously passed to listenForChanges.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

    • Method Detail

      • getAllowedAccounts

        @Nullable() static List<AllowedAccountInfo> getAllowedAccounts()

        Returns the list of allowed accounts or null if restrictions are not in place. If the list is non-null, the app is expected to allow only AAD-based accounts corresponding to the listed UPNs to sign in.

        Returns:

        list of allowed accounts or null if no restrictions

      • isAccountAllowed

         static boolean isAccountAllowed(@NonNull() String upnOrAADId)

        Check if the given UPN or AAD user id (both case-insensitive) is allowed to sign in.

        Parameters:
        upnOrAADId - UPN or AAD id to check
        Returns:

        true if the given user is allowed to sign in, false otherwise

      • listenForChanges

         static void listenForChanges(@NonNull() AllowedAccountsListener listener)

        Listen for changed to the allowed account list. The provided listener will be invoked if and when changes occur.

        Parameters:
        listener - listener to receive change notifications
      • unregisterListener

         static void unregisterListener(@NonNull() AllowedAccountsListener listener)

        Unregister a listener previously passed to listenForChanges. Note that it is recommended to maintain a listener for the process lifetime to ensure that your app responds to changes in allowed account promptly, and therefore most apps are not expected to need this method. If you unregister all listeners, you must take care to check the value of getAllowedAccounts() to respond to changes as soon as possible.

        Parameters:
        listener - listener to unregister