MSALCacheConfig

Objective-C

@interface MSALCacheConfig : NSObject <NSCopying>

Swift

class MSALCacheConfig : NSObject, NSCopying

MSAL configuration interface responsible for token caching and keychain configuration.

Configure keychain sharing

  • The keychain sharing group to use for the token cache. The default value is com.microsoft.adalcache for iOS and com.microsoft.identity.universalstorage for macOS and it needs to be declared in your application’s entitlements. See more https://developer.apple.com/documentation/security/keychain_services/keychain_items/sharing_access_to_keychain_items_among_a_collection_of_apps?language=objc

    Note

    To disable keychain sharing, set this to your bundleIdentifier using [[NSBundle mainBundle] bundleIdentifier]. MSAL will then use your private keychain group, which is available only to your application.

    Declaration

    Objective-C

    @property NSString *_Nonnull keychainSharingGroup;

    Swift

    var keychainSharingGroup: String { get set }
  • Retrieve default MSAL keychain access group. The default value is com.microsoft.adalcache for iOS and com.microsoft.identity.universalstorage for macOS

    Declaration

    Objective-C

    + (nonnull NSString *)defaultKeychainSharingGroup;

    Swift

    class func defaultKeychainSharingGroup() -> String

Extend MSAL account cache

  • List of external account storage providers that helps you to combine your own accounts with MSAL accounts and use a consistent API for the account management and enumeration. Each external account provider is responsible for retrieving, enumerating, updating and removing external accounts. Some examples where this might be useful:

    1. An app is migrating from ADAL to MSAL. Because ADAL didn’t support account enumeration, developer built a separate layer to store ADAL accounts in the app. MSAL provides account enumeration built-in. Using this API, application can let MSAL combine multiple sources of accounts and operate on a single source.
    2. An app duplicates MSAL accounts in its own account storage with some additional app specific data. Every time when MSAL retrieves/updates an account, application wants to synchronize that account into its own account store.

    Declaration

    Objective-C

    @property (nonatomic, readonly) NSArray<id<MSALExternalAccountProviding>> *_Nonnull externalAccountProviders;

    Swift

    var externalAccountProviders: [MSALExternalAccountProviding] { get }
  • Adds a new external account storage provider to be used by MSAL in account retrieval.

    Note

    This operation is not thread safe.

    Declaration

    Objective-C

    - (void)addExternalAccountProvider:
        (nonnull id<MSALExternalAccountProviding>)externalAccountProvider;

    Swift

    func addExternalAccountProvider(_ externalAccountProvider: MSALExternalAccountProviding)

Unavailable initializers