-
Notifications
You must be signed in to change notification settings - Fork 113
Caching
Click on your project in the Navigator pane in Xcode. Click on your application target and then the "Capabilities" tab. Scroll down to "Keychain Sharing" and flip the switch on. Add "com.microsoft.adalcache" to that list.
Alternatively you can disable keychain sharing by setting the keychain sharing group to nil. your application's bundle id.
[[ADAuthenticationSettings sharedInstance] setSharedCacheKeychainGroup:nil];
If you need to inspect the cache in your app, you can do it through the ADKeychainTokenCache interface.
Keychain is not directly supported by ADAL on Mac OS X. The default caching implementation will keep around tokens for the life time of the process, but they will not be persisted. If you wish to persist tokens you must implement the ADTokenCacheDelegate and provide it on AuthenticationContext creation
@protocol ADTokenCacheDelegate <NSObject>
- (void)willAccessCache:(nonnull ADTokenCache *)cache;
- (void)didAccessCache:(nonnull ADTokenCache *)cache;
- (void)willWriteCache:(nonnull ADTokenCache *)cache;
- (void)didWriteCache:(nonnull ADTokenCache *)cache;
@end
In this delegate you can call -serialize and -deserialize on the cache object to save or update the cache in the form of an NSData binary blob.