Skip to content
This repository was archived by the owner on Jan 21, 2022. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions MASFoundation/Classes/MAS.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,26 @@



/**
* Sets BOOL indicator whether the Keychain is synchronized through iCloud.
* By default, the Keychain is not synchronized through iCloud.
*
* @param enabled BOOL YES to enable synchroniztion, NO to disable it.
*/
+ (void)setKeychainSynchronizable:(BOOL)enabled;



/**
* Gets BOOL indicator of Keychain sincronization enabled or not.
* By default, the Keychain is not synchronized through iCloud.
*
* @return return BOOL value indicating Keychain sincronization is enabled or not
*/
+ (BOOL)isKeychainSynchronizable;



///--------------------------------------
/// @name Start & Stop
///--------------------------------------
Expand Down
12 changes: 12 additions & 0 deletions MASFoundation/Classes/MAS.m
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,18 @@ + (void)setGatewayMonitor:(MASGatewayMonitorStatusBlock)monitor
}


+ (void)setKeychainSynchronizable:(BOOL)enabled
{
[MASAccessService setKeychainSynchronizable:enabled];
}


+ (BOOL)isKeychainSynchronizable
{
return [MASAccessService isKeychainSynchronizable];
}


+ (MASState)MASState
{
//
Expand Down
18 changes: 18 additions & 0 deletions MASFoundation/Classes/_private_/services/access/MASAccessService.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,24 @@ typedef NS_ENUM(NSInteger, MASAccessValueType)



/**
* Static boolean property indicating Keychain sincronization is enabled or not.
*
* @return return BOOL value indicating Keychain sincronization is enabled or not
*/
+ (BOOL)isKeychainSynchronizable;



/**
* Setter of static boolean property indicating Keychain sincronization is enabled or not.
*
* @param enable BOOL value indicating Keychain sincronization is enabled or not
*/
+ (void)setKeychainSynchronizable:(BOOL)enable;



///--------------------------------------
/// @name Shared Service
///--------------------------------------
Expand Down
35 changes: 21 additions & 14 deletions MASFoundation/Classes/_private_/services/access/MASAccessService.m
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ @implementation MASAccessService

static BOOL _isPKCEEnabled_ = YES;

static BOOL _isKeychainSynchronizable_ = NO;

# pragma mark - Properties

Expand All @@ -64,6 +65,18 @@ + (void)enablePKCE:(BOOL)enable
}


+ (BOOL)isKeychainSynchronizable
{
return _isKeychainSynchronizable_;
}


+ (void)setKeychainSynchronizable:(BOOL)enable
{
_isKeychainSynchronizable_ = enable;
}


# pragma mark - Shared Service

+ (instancetype)sharedService
Expand Down Expand Up @@ -102,36 +115,30 @@ - (void)serviceWillStart
//
_gatewayIdentifier = [MASConfiguration currentConfiguration].gatewayUrl.absoluteString;


_localStorageServiceName = [NSString stringWithFormat:@"%@.%@", _gatewayIdentifier, kMASAccessLocalStorageServiceName];

_sharedStorageServiceName = [NSString stringWithFormat:@"%@.%@", _gatewayIdentifier, kMASAccessSharedStorageServiceName];

//
// Local storage
//
MASIKeyChainStore *localStorage = [MASIKeyChainStore keyChainStoreWithService:_localStorageServiceName];
localStorage.synchronizable = _isKeychainSynchronizable_;

if ([MASConfiguration currentConfiguration].ssoEnabled && [self isAccessGroupAccessible])
{

//
// Local storage
//
MASIKeyChainStore *localStorage = [MASIKeyChainStore keyChainStoreWithService:_localStorageServiceName];

//
// Shared storage
//
MASIKeyChainStore *sharedStorage = [MASIKeyChainStore keyChainStoreWithService:_sharedStorageServiceName accessGroup:self.accessGroup];

sharedStorage.synchronizable = _isKeychainSynchronizable_;

//
// storage dictionary property
//
_storages = [NSDictionary dictionaryWithObjectsAndKeys:localStorage, kMASAccessLocalStorageKey, sharedStorage, kMASAccessSharedStorageKey, nil];
}
else {

//
// Local storage
//
MASIKeyChainStore *localStorage = [MASIKeyChainStore keyChainStoreWithService:_localStorageServiceName];

//
// storage dictionary property
//
Expand Down