public final class

AllowedAccounts

extends Object
java.lang.Object
   ↳ com.microsoft.intune.mam.client.app.AllowedAccounts

Class Overview

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.

Summary

Public Methods
static List<AllowedAccountInfo> getAllowedAccounts()
Returns the list of allowed accounts or null if restrictions are not in place.
static boolean isAccountAllowed(String upnOrAADId)
Check if the given UPN or AAD user id (both case-insensitive) is allowed to sign in.
static void listenForChanges(AllowedAccountsListener listener)
Listen for changed to the allowed account list.
static void unregisterListener(AllowedAccountsListener listener)
Unregister a listener previously passed to listenForChanges.
[Expand]
Inherited Methods
From class java.lang.Object

Public Methods

public 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

public static boolean isAccountAllowed (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

public static void listenForChanges (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

public static void unregisterListener (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