MSALExternalAccountProviding

Objective-C

@protocol MSALExternalAccountProviding <NSObject>

Swift

protocol MSALExternalAccountProviding : NSObjectProtocol

Use this protocol if you have external account storage in addition to MSAL account storage. For example, if you find yourself in situation where on each MSAL completion block invocation you are updating accounts in your own storage, it might be beneficial to instead use MSALExternalAccountProviding extensibility feature.

  • This is called when new and/or updated account is available.

    Declaration

    Objective-C

    - (BOOL)updateAccount:(nonnull id<MSALAccount>)account
            idTokenClaims:(nonnull NSDictionary *)idTokenClaims
                    error:(NSError *_Nullable *_Nullable)error;

    Swift

    func update(_ account: MSALAccount, idTokenClaims: [AnyHashable : Any]) throws
  • Deprecated

    Use -removeAccount:wipeAccount:tenantProfiles:error: instead

    This is triggered when removal of an account is necessary. It normally happens when the app calls removeAccount API in MSAL. But it can also happen in other circumstances when MSAL needs to cleanup account.

    Declaration

    Objective-C

    - (BOOL)removeAccount:(nonnull id<MSALAccount>)account
           tenantProfiles:(nullable NSArray<MSALTenantProfile *> *)tenantProfiles
                    error:(NSError *_Nullable *_Nullable)error;

    Swift

    func remove(_ account: MSALAccount, tenantProfiles: [MSALTenantProfile]?) throws
  • This is triggered when removal of an account is necessary. It normally happens when the app calls removeAccount API in MSAL. But it can also happen in other circumstances when MSAL needs to cleanup account. If wipeAccount == YES, it means application requested full removal of the account and all related artifacts.

    Declaration

    Objective-C

    - (BOOL)removeAccount:(nonnull id<MSALAccount>)account
              wipeAccount:(BOOL)wipeAccount
           tenantProfiles:(nullable NSArray<MSALTenantProfile *> *)tenantProfiles
                    error:(NSError *_Nullable *_Nullable)error;

    Swift

    func remove(_ account: MSALAccount, wipeAccount: Bool, tenantProfiles: [MSALTenantProfile]?) throws
  • This is triggered when MSAL needs to enumerate account. Return your accounts that match parameters. MSAL will merge external accounts with its own internal storage and return a combined list of accounts that mathes specified parameters.

    Declaration

    Objective-C

    - (nullable NSArray<id<MSALAccount>> *)
        accountsWithParameters:
            (nonnull MSALAccountEnumerationParameters *)parameters
                         error:(NSError *_Nullable *_Nullable)error;

    Swift

    func accounts(with parameters: MSALAccountEnumerationParameters) throws -> [MSALAccount]