Skip to content

Commit 081d7dc

Browse files
committed
Merge branch 'hotfix/1.7.42-hotfix' into hotfix/1.7.43-hotfix
2 parents e9e97ed + b7df792 commit 081d7dc

16 files changed

+42
-3
lines changed

IdentityCore/src/broker_operation/request/token_request/MSIDBrokerOperationTokenRequest.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ NS_ASSUME_NONNULL_BEGIN
3636
@property (nonatomic) MSIDProviderType providerType;
3737
@property (nonatomic, nullable) NSString *oidcScope;
3838
@property (nonatomic, nullable) NSDictionary *extraQueryParameters;
39+
@property (nonatomic) BOOL allowAnyExtraURLQueryParameters;
3940
@property (nonatomic) BOOL instanceAware;
4041
@property (nonatomic, nullable) NSDictionary *enrollmentIds;
4142
@property (nonatomic, nullable) NSDictionary *mamResources;
@@ -48,6 +49,8 @@ NS_ASSUME_NONNULL_BEGIN
4849
@property (nonatomic, nullable) NSString *clientSku;
4950
@property (nonatomic) BOOL skipValidateResultAccount;
5051
@property (nonatomic) BOOL forceRefresh;
52+
@property (nonatomic) BOOL ignoreScopeValidation;
53+
5154

5255
+ (BOOL)fillRequest:(MSIDBrokerOperationTokenRequest *)request
5356
withParameters:(MSIDRequestParameters *)parameters

IdentityCore/src/broker_operation/request/token_request/MSIDBrokerOperationTokenRequest.m

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ + (BOOL)fillRequest:(MSIDBrokerOperationTokenRequest *)request
6666
request.skipValidateResultAccount = parameters.skipValidateResultAccount;
6767
request.forceRefresh = parameters.forceRefresh;
6868
request.platformSequence = parameters.platformSequence;
69+
request.allowAnyExtraURLQueryParameters = parameters.allowAnyExtraURLQueryParameters;
70+
request.ignoreScopeValidation = parameters.ignoreScopeValidation;
6971
return YES;
7072
}
7173

@@ -153,6 +155,7 @@ - (NSDictionary *)jsonDictionary
153155
json[MSID_CLIENT_SKU_KEY] = self.clientSku;
154156
json[MSID_SKIP_VALIDATE_RESULT_ACCOUNT_KEY] = [@(self.skipValidateResultAccount) stringValue];
155157
json[MSID_FORCE_REFRESH_KEY] = [@(self.forceRefresh) stringValue];
158+
156159
return json;
157160
}
158161

IdentityCore/src/broker_operation/response/browser_native_message_response/MSIDBrowserNativeMessageGetTokenResponse.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,15 +71,15 @@ - (NSDictionary *)jsonDictionary
7171
}
7272

7373
__auto_type accountJson = [NSMutableDictionary new];
74-
accountJson[@"userName"] = tokenResponse.idTokenObj.username;
74+
accountJson[@"userName"] = tokenResponse.accountUpn;
7575
accountJson[@"id"] = tokenResponse.accountIdentifier;
7676

7777
response[@"account"] = accountJson;
7878
response[@"state"] = self.state;
7979

8080
__auto_type propertiesJson = [NSMutableDictionary new];
8181
// TODO: once ests follow the latest protocol, this should be removed. Account ID should be read from accountJson.
82-
propertiesJson[@"UPN"] = tokenResponse.idTokenObj.username;
82+
propertiesJson[@"UPN"] = accountJson[@"userName"];
8383
response[@"properties"] = propertiesJson;
8484

8585
return response;

IdentityCore/src/oauth2/MSIDOauth2Factory.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ - (BOOL)fillAccount:(MSIDAccount *)account
375375
fromResponse:(MSIDTokenResponse *)response
376376
configuration:(MSIDConfiguration *)configuration
377377
{
378-
NSString *homeAccountId = response.idTokenObj.userId;
378+
NSString *homeAccountId = response.idTokenObj.userId ?: [response accountIdentifier];
379379

380380
if (!homeAccountId)
381381
{

IdentityCore/src/oauth2/MSIDTokenResponse.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@
9191

9292
@property (nonatomic, readonly, nullable) NSString *accountIdentifier;
9393

94+
@property (nonatomic, readonly, nullable) NSString *accountUpn;
95+
9496
- (nullable instancetype)initWithJSONDictionary:(nonnull NSDictionary *)json
9597
refreshToken:(nullable MSIDBaseToken<MSIDRefreshableToken> *)token
9698
error:(NSError * _Nullable __autoreleasing *_Nullable)error;

IdentityCore/src/oauth2/MSIDTokenResponse.m

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,11 @@ - (NSString *)accountIdentifier
131131
return self.idTokenObj.uniqueId;
132132
}
133133

134+
- (NSString *)accountUpn
135+
{
136+
return self.idTokenObj.username;
137+
}
138+
134139
#pragma mark - Protected
135140

136141
- (MSIDIdTokenClaims *)tokenClaimsFromRawIdToken:(NSString *)rawIdToken error:(NSError *__autoreleasing*)error

IdentityCore/src/oauth2/aad_base/MSIDAADTokenResponse.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
@property (nonatomic, nullable) MSIDClientInfo *clientInfo;
3838
@property (nonatomic, nullable) NSString *familyId;
3939
@property (nonatomic, nullable) NSString *suberror;
40+
/// UPN of the user.
4041
@property (nonatomic, nullable) NSString *additionalUserId;
4142

4243
// Custom properties that ADAL/MSAL handles

IdentityCore/src/oauth2/aad_base/MSIDAADTokenResponse.m

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,11 @@ - (NSString *)accountIdentifier
7979
return self.clientInfo.accountIdentifier;
8080
}
8181

82+
- (NSString *)accountUpn
83+
{
84+
return [super accountUpn] ?: self.additionalUserId;
85+
}
86+
8287
#pragma mark - MSIDJsonSerializable
8388

8489
- (instancetype)initWithJSONDictionary:(NSDictionary *)json error:(NSError *__autoreleasing*)error

IdentityCore/src/parameters/MSIDRequestParameters.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
@property (nonatomic) NSString *oidcScope;
5555
@property (nonatomic) MSIDAccountIdentifier *accountIdentifier;
5656
@property (nonatomic) BOOL validateAuthority;
57+
@property (nonatomic) BOOL ignoreScopeValidation;
5758
@property (nonatomic) NSString *nonce;
5859
@property (nonatomic) NSString *clientSku;
5960
@property (nonatomic) BOOL skipValidateResultAccount;
@@ -67,6 +68,8 @@
6768
@property (nonatomic) NSDictionary *extraTokenRequestParameters;
6869
// Additional URL query parameters that will be added to both token and authorize requests
6970
@property (nonatomic) NSDictionary *extraURLQueryParameters;
71+
// Currently used only in broker to enable/disable EQP filtering.
72+
@property (nonatomic) BOOL allowAnyExtraURLQueryParameters;
7073
@property (nonatomic) NSUInteger tokenExpirationBuffer;
7174
@property (nonatomic) BOOL extendedLifetimeEnabled;
7275
@property (nonatomic) BOOL instanceAware;

IdentityCore/src/requests/sdk/MSIDTokenResponseValidator.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@
6868
- (BOOL)validateTokenResult:(nonnull MSIDTokenResult *)tokenResult
6969
configuration:(nonnull MSIDConfiguration *)configuration
7070
oidcScope:(nullable NSString *)oidcScope
71+
validateScopes:(BOOL)validateScopes
7172
correlationID:(nonnull NSUUID *)correlationID
7273
error:(NSError * _Nullable __autoreleasing * _Nullable)error;
7374

0 commit comments

Comments
 (0)