-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add SsoExt identifier into MSIDDeviceInfo #1488
base: dev
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,6 +55,12 @@ typedef NS_ENUM(NSInteger, MSIDPreferredAuthMethod) | |
MSIDPreferredAuthMethodQRPIN | ||
}; | ||
|
||
typedef NS_ENUM(NSInteger, MSIDSsoProviderType) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would it be beneficial to make this enum available in a separate header file? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There are other enums in this file as of today, we can move out when more enums coming for better management |
||
{ | ||
MSIDUnknownSsoProvider = 0, | ||
MSIDMacBrokerSsoProvider, | ||
MSIDCompanyPortalSsoProvider | ||
}; | ||
juan-arias marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
|
@@ -64,6 +70,7 @@ NS_ASSUME_NONNULL_BEGIN | |
@property (nonatomic) MSIDSSOExtensionMode ssoExtensionMode; | ||
@property (nonatomic) MSIDWorkPlaceJoinStatus wpjStatus; | ||
@property (nonatomic, nullable) NSString *brokerVersion; | ||
@property (nonatomic) MSIDSsoProviderType ssoProviderType; | ||
@property (nonatomic) NSDictionary *additionalExtensionData; | ||
@property (nonatomic) MSIDPreferredAuthMethod preferredAuthConfig; | ||
|
||
|
@@ -77,7 +84,8 @@ NS_ASSUME_NONNULL_BEGIN | |
- (instancetype)initWithDeviceMode:(MSIDDeviceMode)deviceMode | ||
ssoExtensionMode:(MSIDSSOExtensionMode)ssoExtensionMode | ||
isWorkPlaceJoined:(BOOL)isWorkPlaceJoined | ||
brokerVersion:(NSString *)brokerVersion; | ||
brokerVersion:(NSString *)brokerVersion | ||
ssoProviderType:(MSIDSsoProviderType)ssoProviderType; | ||
|
||
@end | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,11 +31,11 @@ | |
|
||
@implementation MSIDDeviceInfo | ||
|
||
|
||
- (instancetype)initWithDeviceMode:(MSIDDeviceMode)deviceMode | ||
ssoExtensionMode:(MSIDSSOExtensionMode)ssoExtensionMode | ||
isWorkPlaceJoined:(BOOL)isWorkPlaceJoined | ||
brokerVersion:(NSString *)brokerVersion | ||
ssoProviderType:(MSIDSsoProviderType)ssoProviderType | ||
{ | ||
self = [super init]; | ||
|
||
|
@@ -45,6 +45,7 @@ - (instancetype)initWithDeviceMode:(MSIDDeviceMode)deviceMode | |
_ssoExtensionMode = ssoExtensionMode; | ||
_wpjStatus = isWorkPlaceJoined ? MSIDWorkPlaceJoinStatusJoined : MSIDWorkPlaceJoinStatusNotJoined; | ||
_brokerVersion = brokerVersion; | ||
_ssoProviderType = ssoProviderType; | ||
} | ||
|
||
return self; | ||
|
@@ -66,6 +67,7 @@ - (instancetype)initWithJSONDictionary:(NSDictionary *)json error:(__unused NSEr | |
|
||
#if TARGET_OS_OSX | ||
_platformSSOStatus = [self platformSSOStatusEnumFromString:[json msidStringObjectForKey:MSID_PLATFORM_SSO_STATUS_KEY]]; | ||
_ssoProviderType = [self ssoProviderTypeEnumFromString:[json msidStringObjectForKey:MSID_BROKER_BROKER_TYPE_KEY]]; | ||
#endif | ||
|
||
NSString *jsonDataString = [json msidStringObjectForKey:MSID_ADDITIONAL_EXTENSION_DATA_KEY]; | ||
|
@@ -97,6 +99,7 @@ - (NSDictionary *)jsonDictionary | |
json[MSID_BROKER_PREFERRED_AUTH_CONFIGURATION_KEY] = [self preferredAuthConfigurationStringFromEnum:self.preferredAuthConfig]; | ||
#if TARGET_OS_OSX | ||
json[MSID_PLATFORM_SSO_STATUS_KEY] = [self platformSSOStatusStringFromEnum:self.platformSSOStatus]; | ||
json[MSID_BROKER_BROKER_TYPE_KEY] = [self ssoProviderTypeStringFromEnum:self.ssoProviderType]; | ||
#endif | ||
json[MSID_ADDITIONAL_EXTENSION_DATA_KEY] = [self.additionalExtensionData msidJSONSerializeWithContext:nil]; | ||
if (self.extraDeviceInfo) | ||
|
@@ -215,4 +218,24 @@ - (MSIDPreferredAuthMethod)preferredAuthConfigurationEnumFromString:(NSString *) | |
return MSIDPreferredAuthMethodNotConfigured; | ||
} | ||
|
||
- (NSString *)ssoProviderTypeStringFromEnum:(MSIDSsoProviderType)deviceMode | ||
{ | ||
switch (deviceMode) { | ||
kaisong1990 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
case MSIDCompanyPortalSsoProvider: | ||
return @"companyPortal"; | ||
case MSIDMacBrokerSsoProvider: | ||
return @"macBroker"; | ||
default: | ||
return @"unknown"; | ||
} | ||
} | ||
|
||
- (MSIDSsoProviderType)ssoProviderTypeEnumFromString:(NSString *)deviceModeString | ||
{ | ||
if ([deviceModeString isEqualToString:@"companyPortal"]) return MSIDCompanyPortalSsoProvider; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Create a static dictionary <string, MSIDSsoProviderType> instead of if statements and return value for key. Return unknown by default in no matching key There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hi @ameyapat, cannot put |
||
if ([deviceModeString isEqualToString:@"macBroker"]) return MSIDMacBrokerSsoProvider; | ||
|
||
return MSIDUnknownSsoProvider; | ||
} | ||
|
||
@end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This pull request does not update changelog.txt.
Please consider if this change would be noticeable to a partner or user and either update changelog.txt or resolve this conversation.