Class AllowedAccounts
-
- All Implemented Interfaces:
public final class AllowedAccountsAllows 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.
-
-
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 booleanisAccountAllowed(@NonNull() String upnOrAADId)Check if the given UPN or AAD user id (both case-insensitive) is allowed to sign in. static voidlistenForChanges(@NonNull() AllowedAccountsListener listener)Listen for changed to the allowed account list. static voidunregisterListener(@NonNull() AllowedAccountsListener listener)Unregister a listener previously passed to listenForChanges. -
-
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
-
-
-
-