Skip to content

Commit 86d16e0

Browse files
committed
Merge branch 'dev' into ameyapat/msid-jwe-decryptor
* dev: (65 commits) Resolve error Reset flag in teardown Address comments Remove flight and test Update changelog Check boolValue but not presence of value. Add more unit tests Mocking flight and cache value Add Feature flag and cache to control enablement trigger pipeline Clean up changes fix a typo fix deprecation compiling issue Update test and number in time based claims Fix UT Add long casting Updating error to interaction required remove extra ; Address comment Support domain_hint param. Release 1.16.1 ... # Conflicts: # IdentityCore/IdentityCore.xcodeproj/project.pbxproj # IdentityCore/src/MSIDConstants.h # changelog.txt
2 parents 5b0ca1c + db0321e commit 86d16e0

File tree

48 files changed

+2414
-80
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+2414
-80
lines changed

IdentityCore/IdentityCore.xcodeproj/project.pbxproj

Lines changed: 66 additions & 22 deletions
Large diffs are not rendered by default.

IdentityCore/src/MSIDConstants.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,12 +211,15 @@ extern NSString * _Nonnull const MSID_FRT_STATUS_DISABLED;
211211
extern NSString * _Nonnull const MSID_BROWSER_RESPONSE_SWITCH_BROWSER;
212212
extern NSString * _Nonnull const MSID_BROWSER_RESPONSE_SWITCH_BROWSER_RESUME;
213213

214+
extern NSString * _Nonnull const MSID_BOUND_RT_REDEEM;
215+
214216
extern NSString * _Nonnull const MSID_FLIGHT_USE_V2_WEB_RESPONSE_FACTORY;
215217
extern NSString * _Nonnull const MSID_FLIGHT_SUPPORT_DUNA_CBA;
216218
extern NSString * _Nonnull const MSID_FLIGHT_DISABLE_JIT_TROUBLESHOOTING_LEGACY_AUTH;
217219
extern NSString * _Nonnull const MSID_FLIGHT_CLIENT_SFRT_STATUS;
218220
extern NSString * _Nonnull const MSID_FLIGHT_DISABLE_PREFERRED_IDENTITY_CBA;
219221
extern NSString * _Nonnull const MSID_FLIGHT_SUPPORT_STATE_DUNA_CBA;
222+
extern NSString * _Nonnull const MSID_FLIGHT_IGNORE_COOKIES_IN_DUNA_RESUME;
220223

221224
/**
222225
* Flight to indicate if remove account artifacts should be disabled
@@ -234,4 +237,8 @@ extern NSString * _Nonnull const MSID_FLIGHT_DISABLE_REMOVE_ACCOUNT_ARTIFACTS;
234237
/// ECS configuration id: /1678824
235238
extern NSString * _Nonnull const MSID_FLIGHT_IS_BART_SUPPORTED;
236239

240+
extern NSString * _Nonnull const MSID_FLIGHT_ENABLE_QUERYING_STK;
241+
242+
extern NSString * _Nonnull const MSID_DOMAIN_HINT_KEY;
243+
237244
#define METHODANDLINE [NSString stringWithFormat:@"%s [Line %d]", __PRETTY_FUNCTION__, __LINE__]

IdentityCore/src/MSIDConstants.m

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,16 +83,25 @@
8383
NSString *const MSID_BROWSER_RESPONSE_SWITCH_BROWSER = @"switch_browser";
8484
NSString *const MSID_BROWSER_RESPONSE_SWITCH_BROWSER_RESUME = @"switch_browser_resume";
8585

86+
// Bound App Refresh token constants
87+
NSString *const MSID_BOUND_RT_REDEEM = @"bound_rt_redeem";
88+
8689
NSString *const MSID_FLIGHT_USE_V2_WEB_RESPONSE_FACTORY = @"use_v2_web_response_factory";
8790
NSString *const MSID_FLIGHT_SUPPORT_DUNA_CBA = @"support_duna_cba_v2";
8891
NSString *const MSID_FLIGHT_DISABLE_JIT_TROUBLESHOOTING_LEGACY_AUTH = @"disable_jit_remediation_legacy_auth";
8992
NSString *const MSID_FLIGHT_CLIENT_SFRT_STATUS = @"sfrt_v2";
9093
NSString *const MSID_FLIGHT_DISABLE_PREFERRED_IDENTITY_CBA = @"dis_pre_iden_cba";
9194
NSString *const MSID_FLIGHT_SUPPORT_STATE_DUNA_CBA = @"support_state_duna_cba";
95+
NSString *const MSID_FLIGHT_IGNORE_COOKIES_IN_DUNA_RESUME = @"ignore_cookies_in_duna_resume";
9296

9397
// Making the flight string short to avoid legacy broker url size limit
9498
NSString *const MSID_FLIGHT_DISABLE_REMOVE_ACCOUNT_ARTIFACTS = @"disable_rm_metadata";
9599

100+
NSString *const MSID_FLIGHT_ENABLE_QUERYING_STK = @"enable_querying_stk";
101+
NSString *const MSID_FLIGHT_IS_BART_SUPPORTED = @"is_msal_bart_supported";
102+
103+
NSString *const MSID_DOMAIN_HINT_KEY = @"domain_hint";
104+
96105

97106
NSString *const MSID_FLIGHT_IS_BART_SUPPORTED = @"is_bound_app_rt_supported";
98107

IdentityCore/src/MSIDFlightManager.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525

2626
#import <Foundation/Foundation.h>
27+
#import "MSIDFlightManagerQueryKeyDelegate.h"
2728

2829
NS_ASSUME_NONNULL_BEGIN
2930

@@ -38,8 +39,11 @@ NS_ASSUME_NONNULL_BEGIN
3839
@interface MSIDFlightManager : NSObject <MSIDFlightManagerInterface>
3940

4041
@property (nonatomic, nullable) id<MSIDFlightManagerInterface> flightProvider;
42+
@property (nonatomic, nullable) id<MSIDFlightManagerQueryKeyDelegate> queryKeyFlightProvider;
4143

4244
+ (instancetype)sharedInstance;
45+
+ (instancetype)sharedInstanceByQueryKey:(NSString *)queryKey
46+
keyType:(MSIDFlightManagerQueryKeyType)keyType;
4347

4448
@end
4549

IdentityCore/src/MSIDFlightManager.m

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,56 @@ + (instancetype)sharedInstance
4545
return sharedInstance;
4646
}
4747

48+
+ (instancetype)sharedInstanceByQueryKey:(NSString *)queryKey
49+
keyType:(MSIDFlightManagerQueryKeyType)keyType
50+
{
51+
if ([NSString msidIsStringNilOrBlank:queryKey])
52+
{
53+
// Use shared flight manager if queryKey is nil or empty
54+
return [MSIDFlightManager sharedInstance];
55+
}
56+
57+
static NSMutableDictionary<NSString *, MSIDFlightManager *> *instancesByQueryKey = nil;
58+
static dispatch_once_t onceToken;
59+
static dispatch_queue_t synchronizationQueue;
60+
61+
dispatch_once(&onceToken, ^{
62+
instancesByQueryKey = [NSMutableDictionary new];
63+
synchronizationQueue = dispatch_queue_create("com.microsoft.msidflightmanager.querykey", DISPATCH_QUEUE_CONCURRENT);
64+
});
65+
66+
__block MSIDFlightManager *instance = nil;
67+
68+
// First, try to read the instance concurrently
69+
dispatch_sync(synchronizationQueue, ^{
70+
instance = instancesByQueryKey[queryKey];
71+
});
72+
73+
if (!instance)
74+
{
75+
// If not found, create and insert with a barrier write
76+
dispatch_barrier_sync(synchronizationQueue, ^{
77+
instance = instancesByQueryKey[queryKey];
78+
if (!instance)
79+
{
80+
instance = [[self.class alloc] initInternal];
81+
82+
id<MSIDFlightManagerInterface> flightProvider = [[MSIDFlightManager sharedInstance].queryKeyFlightProvider
83+
flightProviderForQueryKey:queryKey
84+
keyType:keyType];
85+
if (flightProvider)
86+
{
87+
instance.flightProvider = flightProvider;
88+
}
89+
90+
instancesByQueryKey[queryKey] = instance;
91+
}
92+
});
93+
}
94+
95+
return instance;
96+
}
97+
4898
- (instancetype)initInternal
4999
{
50100
self = [super init];

IdentityCore/src/cache/crypto/MSIDWPJKeyPairWithCert+TransportKey.m renamed to IdentityCore/src/MSIDFlightManagerQueryKeyDelegate.h

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -22,28 +22,14 @@
2222
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2323
// THE SOFTWARE.
2424

25-
#import "MSIDWPJKeyPairWithCert.h"
26-
#import "MSIDWPJKeyPairWithCert+TransportKey.h"
25+
#import <Foundation/Foundation.h>
26+
#import "MSIDFlightManagerQueryKeyType.h"
2727

28-
@implementation MSIDWPJKeyPairWithCert (TransportKey)
28+
@protocol MSIDFlightManagerInterface;
2929

30-
- (void)setPrivateTransportKeyRef:(SecKeyRef)privateTransportKeyRef
31-
{
32-
if (_privateTransportKeyRef != privateTransportKeyRef)
33-
{
34-
if (_privateTransportKeyRef)
35-
{
36-
CFRelease(_privateTransportKeyRef);
37-
_privateTransportKeyRef = NULL;
38-
}
39-
40-
_privateTransportKeyRef = privateTransportKeyRef;
41-
42-
if (_privateTransportKeyRef)
43-
{
44-
CFRetain(_privateTransportKeyRef);
45-
}
46-
}
47-
}
30+
@protocol MSIDFlightManagerQueryKeyDelegate <NSObject>
31+
32+
- (nullable id<MSIDFlightManagerInterface>)flightProviderForQueryKey:(nonnull NSString *)queryKey
33+
keyType:(nonnull MSIDFlightManagerQueryKeyType)keyType;
4834

4935
@end
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
//
2+
// Copyright (c) Microsoft Corporation.
3+
// All rights reserved.
4+
//
5+
// This code is licensed under the MIT License.
6+
//
7+
// Permission is hereby granted, free of charge, to any person obtaining a copy
8+
// of this software and associated documentation files(the "Software"), to deal
9+
// in the Software without restriction, including without limitation the rights
10+
// to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
11+
// copies of the Software, and to permit persons to whom the Software is
12+
// furnished to do so, subject to the following conditions :
13+
//
14+
// The above copyright notice and this permission notice shall be included in
15+
// all copies or substantial portions of the Software.
16+
//
17+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23+
// THE SOFTWARE.
24+
25+
#import <Foundation/Foundation.h>
26+
27+
NS_ASSUME_NONNULL_BEGIN
28+
29+
typedef NSString * MSIDFlightManagerQueryKeyType NS_STRING_ENUM;
30+
31+
extern MSIDFlightManagerQueryKeyType const MSIDFlightManagerQueryKeyTypeTenantId;
32+
extern MSIDFlightManagerQueryKeyType const MSIDFlightManagerQueryKeyTypeAppBundleId;
33+
extern MSIDFlightManagerQueryKeyType const MSIDFlightManagerQueryKeyTypeEcsRegion;
34+
extern MSIDFlightManagerQueryKeyType const MSIDFlightManagerQueryKeyTypeUpn;
35+
extern MSIDFlightManagerQueryKeyType const MSIDFlightManagerQueryKeyTypeUserId;
36+
extern MSIDFlightManagerQueryKeyType const MSIDFlightManagerQueryKeyTypeVersionNumber;
37+
38+
NS_ASSUME_NONNULL_END
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
//
2+
// Copyright (c) Microsoft Corporation.
3+
// All rights reserved.
4+
//
5+
// This code is licensed under the MIT License.
6+
//
7+
// Permission is hereby granted, free of charge, to any person obtaining a copy
8+
// of this software and associated documentation files(the "Software"), to deal
9+
// in the Software without restriction, including without limitation the rights
10+
// to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
11+
// copies of the Software, and to permit persons to whom the Software is
12+
// furnished to do so, subject to the following conditions :
13+
//
14+
// The above copyright notice and this permission notice shall be included in
15+
// all copies or substantial portions of the Software.
16+
//
17+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23+
// THE SOFTWARE.
24+
25+
#import "MSIDFlightManagerQueryKeyType.h"
26+
27+
MSIDFlightManagerQueryKeyType const MSIDFlightManagerQueryKeyTypeTenantId = @"tenantId";
28+
MSIDFlightManagerQueryKeyType const MSIDFlightManagerQueryKeyTypeAppBundleId = @"appBundleId";
29+
MSIDFlightManagerQueryKeyType const MSIDFlightManagerQueryKeyTypeEcsRegion = @"ecsRegion";
30+
MSIDFlightManagerQueryKeyType const MSIDFlightManagerQueryKeyTypeUpn = @"upn";
31+
MSIDFlightManagerQueryKeyType const MSIDFlightManagerQueryKeyTypeUserId = @"userId";
32+
MSIDFlightManagerQueryKeyType const MSIDFlightManagerQueryKeyTypeVersionNumber = @"version_number";

IdentityCore/src/MSIDOAuth2Constants.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,3 +180,5 @@ extern NSString *const MSID_CCS_REQUEST_ID_RESPONSE;
180180
extern NSString *const MSID_CCS_REQUEST_SEQUENCE_KEY;
181181
extern NSString *const MSID_CCS_REQUEST_SEQUENCE_RESPONSE;
182182
extern NSString *const MSID_BOUND_DEVICE_ID_CACHE_KEY;
183+
extern NSString *const MSID_MSAL_CLIENT_APV_PREFIX;
184+
extern NSString *const MSID_BOUND_REFRESH_TOKEN_EXCHANGE;

IdentityCore/src/MSIDOAuth2Constants.m

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,4 +180,6 @@
180180
NSString *const MSID_CCS_REQUEST_SEQUENCE_KEY = @"x-ms-srs";
181181
NSString *const MSID_CCS_REQUEST_SEQUENCE_RESPONSE = @"ccs-request-sequence";
182182

183+
NSString *const MSID_BOUND_REFRESH_TOKEN_EXCHANGE = @"bound_rt_exchange";
183184
NSString *const MSID_BOUND_DEVICE_ID_CACHE_KEY = @"bound_device_id";
185+
NSString *const MSID_MSAL_CLIENT_APV_PREFIX = @"MsalClient";

0 commit comments

Comments
 (0)