Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
74 commits
Select commit Hold shift + click to select a range
4daf068
Add isBoundAppRefreshTokenRequested property and constants for reques…
ameyapat Oct 23, 2025
a4f9471
Add upn to response.
antrix1989 Oct 29, 2025
a4fe9d9
Merge branch 'dev' into sedemche/fix_upn
antrix1989 Nov 4, 2025
64822bf
add UT for empty upn.
antrix1989 Nov 5, 2025
ce75cfd
rename property.
antrix1989 Nov 5, 2025
e322fbe
Merge pull request #1605 from AzureAD/sedemche/fix_upn
antrix1989 Nov 5, 2025
88046dd
Initial plan
Copilot Nov 6, 2025
37fc58a
Update Xcode version from 15.4 to 16.2 in pr-validation.yml
Copilot Nov 6, 2025
5711964
Initial plan
Copilot Nov 6, 2025
1ffc316
Initial plan
Copilot Nov 6, 2025
1da08cb
Update Xcode version from 15.4 to 16.2 in broker_submodule_check.yml
Copilot Nov 6, 2025
325d434
Update Xcode version from 15.4 to 16.2 in msal_submodule_check.yaml
Copilot Nov 6, 2025
4ed54f1
Merge pull request #1610 from AzureAD/copilot/update-xcode-version-co…
ameyapat Nov 6, 2025
9fd9adf
Merge pull request #1608 from AzureAD/copilot/update-xcode-version-16-2
ameyapat Nov 6, 2025
e74a344
Merge branch 'dev' into copilot/update-xcode-version-to-16-2
ameyapat Nov 6, 2025
aa021a4
Update broker_submodule_check.yml for Azure Pipelines
ameyapat Nov 7, 2025
fc0b921
Merge pull request #1609 from AzureAD/copilot/update-xcode-version-to…
ameyapat Nov 7, 2025
00b01ce
Merge branch 'dev' into josephpab/merge_release_1.17.0_into_dev
josephpab Nov 10, 2025
b460fb6
Merge pull request #1613 from AzureAD/josephpab/merge_release_1.17.0_…
josephpab Nov 10, 2025
50ddc24
fix retain cycle
Nov 12, 2025
e3d41ab
Update IdentityCore/src/requests/broker/MSIDSSORemoteSilentTokenReque…
kaisong1990 Nov 12, 2025
d953684
Update IdentityCore/src/requests/broker/MSIDSSORemoteInteractiveToken…
kaisong1990 Nov 12, 2025
fd28f31
Merge pull request #1614 from AzureAD/kasong/fix-retain-cycle
kaisong1990 Nov 14, 2025
821f00f
Fix lab api
josephpab Nov 16, 2025
f9f4cb0
Swap ADO Connection
Nov 19, 2025
6dd75b2
Add thread starvation
Nov 19, 2025
9f04581
Update folder path
Nov 19, 2025
50f3c1a
Fix issue with legacy keychain on macOS.
juan-arias Nov 19, 2025
e6c6bb7
Update to use function urls instead of codes
josephpab Nov 19, 2025
36cc700
Merge pull request #1617 from AzureAD/nichbop/oa-service-connection
nickbopp Nov 20, 2025
a736112
Merge branch 'dev' into josephpab/labApi
josephpab Nov 20, 2025
6f32175
Add monitoring timeout
Nov 20, 2025
96b1c91
expand the break time
Nov 20, 2025
92d0e4b
Merge branch 'hotfix/1.15.3' into hotfix/1.16.2
juan-arias Nov 20, 2025
199df42
Include gcd starvation data into broker meta data
Nov 20, 2025
9063367
Update log level
Nov 20, 2025
f9f3d77
Update with ECS flight control
Nov 20, 2025
1e259fc
Clean up
Nov 20, 2025
c33e843
Merge branch 'dev' into kasong/3403740-thread-starvation
kaisong1990 Nov 20, 2025
637bab0
Update IdentityCore/src/requests/broker/MSIDSSORemoteSilentTokenReque…
kaisong1990 Nov 20, 2025
af0f3e3
make flight name shorter
Nov 20, 2025
e275f5b
always enable thread starvation detection in debug mode
Nov 20, 2025
a6c9f93
adjust the logic
Nov 21, 2025
51ebe6e
Merge branch 'dev' into ameyapat/requesting-bart-to-broker
ameyapat Nov 22, 2025
54ae2be
Adding documentation
ameyapat Nov 22, 2025
36c8df6
Update to right constant
ameyapat Nov 22, 2025
a20aad2
Silent token request should use FRT first when single FRT is enabled
juan-arias Nov 22, 2025
9af6d32
Update changelog
juan-arias Nov 22, 2025
ac21ce0
Remove test log. Address PR comment.
juan-arias Nov 22, 2025
fe7a354
Address PR comment.
juan-arias Nov 22, 2025
ff7dfca
Merge branch 'dev' into jarias/merge-hotfix-1.16.2-to-dev
juan-arias Nov 24, 2025
57ad23f
Merge pull request #1600 from AzureAD/ameyapat/requesting-bart-to-broker
ameyapat Nov 24, 2025
81f45ab
Merge branch 'dev' into josephpab/labApi
josephpab Nov 24, 2025
37553e1
add @synchronized (self) to function scope
Nov 25, 2025
afa11d4
Address the stravration duration logic
Nov 25, 2025
56a2c9b
Merge branch 'dev' into kasong/3403740-thread-starvation
kaisong1990 Nov 25, 2025
e2178ca
Merge pull request #1622 from AzureAD/kasong/3403740-thread-starvation
kaisong1990 Nov 25, 2025
a1d10d5
Merge pull request #1625 from AzureAD/jarias/merge-hotfix-1.16.2-to-dev
juan-arias Nov 25, 2025
71b209e
increase timeinterval ping test to make it less agreesive, also move …
Nov 26, 2025
f801655
Merge pull request #1624 from AzureAD/jarias/use-frt-first-when-enabled
juan-arias Nov 26, 2025
c55b865
Update IdentityCore/src/requests/broker/MSIDGCDStarvationDetector.m
kaisong1990 Nov 26, 2025
8530f8a
Merge branch 'dev' into kasong/3403740-thread-starvation
kaisong1990 Nov 26, 2025
bad203f
Trigger pipeline
kaisong1990 Nov 26, 2025
afca2cc
Merge pull request #1627 from AzureAD/kasong/3403740-thread-starvation
kaisong1990 Nov 27, 2025
ef38646
Use autolayout for loading indicator.
antrix1989 Nov 27, 2025
03bbe35
modified: changelog.txt
antrix1989 Nov 27, 2025
ed47c1b
use constant.
antrix1989 Nov 27, 2025
e1ddee7
Merge branch 'dev' into josephpab/labApi
josephpab Dec 1, 2025
eba56bb
Merge pull request #1620 from AzureAD/josephpab/labApi
josephpab Dec 1, 2025
7e9b0b6
Merge branch 'dev' into sedemche/fix_loading_indicator
antrix1989 Dec 1, 2025
db37356
Add deviceId constant and property for BART requests/response
ameyapat Dec 1, 2025
655dfb8
Merge pull request #1628 from AzureAD/sedemche/fix_loading_indicator
antrix1989 Dec 1, 2025
2db6bba
Merge pull request #1629 from AzureAD/ameyapat/add-bound-device-id-pr…
ameyapat Dec 1, 2025
49cdbd4
Update change logs
Dec 2, 2025
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
10 changes: 10 additions & 0 deletions IdentityCore/IdentityCore.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,7 @@
2A0278912D6E3216005655B4 /* MSIDAADTokenRequestServerTelemetryTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 2A0278902D6E3216005655B4 /* MSIDAADTokenRequestServerTelemetryTests.m */; };
2A0278922D6E3216005655B4 /* MSIDAADTokenRequestServerTelemetryTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 2A0278902D6E3216005655B4 /* MSIDAADTokenRequestServerTelemetryTests.m */; };
2A0278A32D6E3787005655B4 /* MSIDLastRequestTelemetry+Tests.h in Headers */ = {isa = PBXBuildFile; fileRef = 2A0278A22D6E3787005655B4 /* MSIDLastRequestTelemetry+Tests.h */; };
2A1CBC892ECE5F6E00D2E6BB /* MSIDGCDStarvationDetector.h in Headers */ = {isa = PBXBuildFile; fileRef = 2A886D6C2ECBE3D600675D31 /* MSIDGCDStarvationDetector.h */; };
2A24814D2CB06A1A006FCB34 /* MSIDSSORemoteSilentTokenRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = 2A24814C2CB06A1A006FCB34 /* MSIDSSORemoteSilentTokenRequest.m */; };
2A24814E2CB06A1A006FCB34 /* MSIDSSORemoteSilentTokenRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = 2A24814B2CB06A1A006FCB34 /* MSIDSSORemoteSilentTokenRequest.h */; };
2A24814F2CB06A1A006FCB34 /* MSIDSSORemoteSilentTokenRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = 2A24814C2CB06A1A006FCB34 /* MSIDSSORemoteSilentTokenRequest.m */; };
Expand All @@ -558,6 +559,8 @@
2A59B4402D7924E400304FB1 /* MSIDSSOXpcInteractiveTokenRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = 2A59B43D2D7924E400304FB1 /* MSIDSSOXpcInteractiveTokenRequest.m */; };
2A59B4442D7A0CB500304FB1 /* MSIDXpcInteractiveTokenRequestController.h in Headers */ = {isa = PBXBuildFile; fileRef = 2A59B4412D7A0CB500304FB1 /* MSIDXpcInteractiveTokenRequestController.h */; };
2A59B4452D7A0CB500304FB1 /* MSIDXpcInteractiveTokenRequestController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2A59B4422D7A0CB500304FB1 /* MSIDXpcInteractiveTokenRequestController.m */; };
2A886D6E2ECBE3D600675D31 /* MSIDGCDStarvationDetector.m in Sources */ = {isa = PBXBuildFile; fileRef = 2A886D6D2ECBE3D600675D31 /* MSIDGCDStarvationDetector.m */; };
2A886D702ECBE3D600675D31 /* MSIDGCDStarvationDetector.m in Sources */ = {isa = PBXBuildFile; fileRef = 2A886D6D2ECBE3D600675D31 /* MSIDGCDStarvationDetector.m */; };
2AADDAC72DADB84D00CB7740 /* MSIDSSOXpcSilentTokenRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = 2AADDAC62DADB84D00CB7740 /* MSIDSSOXpcSilentTokenRequest.m */; };
2AADDAC82DADB84D00CB7740 /* MSIDSSOXpcSilentTokenRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = 2AADDAC52DADB84D00CB7740 /* MSIDSSOXpcSilentTokenRequest.h */; };
4B6D22262E831B0B00546EC8 /* MSIDFlightManagerQueryKeyDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B6D22252E831AEA00546EC8 /* MSIDFlightManagerQueryKeyDelegate.h */; };
Expand Down Expand Up @@ -2515,6 +2518,8 @@
2A59B43D2D7924E400304FB1 /* MSIDSSOXpcInteractiveTokenRequest.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MSIDSSOXpcInteractiveTokenRequest.m; sourceTree = "<group>"; };
2A59B4412D7A0CB500304FB1 /* MSIDXpcInteractiveTokenRequestController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MSIDXpcInteractiveTokenRequestController.h; sourceTree = "<group>"; };
2A59B4422D7A0CB500304FB1 /* MSIDXpcInteractiveTokenRequestController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MSIDXpcInteractiveTokenRequestController.m; sourceTree = "<group>"; };
2A886D6C2ECBE3D600675D31 /* MSIDGCDStarvationDetector.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MSIDGCDStarvationDetector.h; sourceTree = "<group>"; };
2A886D6D2ECBE3D600675D31 /* MSIDGCDStarvationDetector.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MSIDGCDStarvationDetector.m; sourceTree = "<group>"; };
2AADDAC52DADB84D00CB7740 /* MSIDSSOXpcSilentTokenRequest.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MSIDSSOXpcSilentTokenRequest.h; sourceTree = "<group>"; };
2AADDAC62DADB84D00CB7740 /* MSIDSSOXpcSilentTokenRequest.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MSIDSSOXpcSilentTokenRequest.m; sourceTree = "<group>"; };
4B6D22252E831AEA00546EC8 /* MSIDFlightManagerQueryKeyDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MSIDFlightManagerQueryKeyDelegate.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -5283,6 +5288,8 @@
B2C7087F2198DE0000D917B8 /* broker */ = {
isa = PBXGroup;
children = (
2A886D6C2ECBE3D600675D31 /* MSIDGCDStarvationDetector.h */,
2A886D6D2ECBE3D600675D31 /* MSIDGCDStarvationDetector.m */,
2A953DF72DA45B3100A748BA /* mac */,
B2C708812198DE0000D917B8 /* MSIDBrokerKeyProvider.h */,
B2C708822198DE0000D917B8 /* MSIDBrokerKeyProvider.m */,
Expand Down Expand Up @@ -6514,6 +6521,7 @@
B286B9C52389DE78007833AD /* MSIDAccountMetadata.h in Headers */,
B2F671E32467A30400649855 /* MSIDInteractiveAuthorizationCodeRequest.h in Headers */,
1E707FE02407336300716148 /* MSIDBrokerBrowserOperationResponse.h in Headers */,
2A1CBC892ECE5F6E00D2E6BB /* MSIDGCDStarvationDetector.h in Headers */,
B4A5ACCD21F7ED4500D2A780 /* MSIDAccountCacheItem+MSIDAccountMatchers.h in Headers */,
F7AB29D8B906BEA5B6EB8F8C /* MSIDWPJMetadata.h in Headers */,
);
Expand Down Expand Up @@ -7450,6 +7458,7 @@
B29A36C120B1289D00427B63 /* MSIDAccountIdentifier.m in Sources */,
B2EE86E123751B6F00D0BC96 /* MSIDSystemWebviewController.m in Sources */,
B266903E243706CF00FB0117 /* MSIDBrokerOperationBrowserTokenRequest.m in Sources */,
2A886D702ECBE3D600675D31 /* MSIDGCDStarvationDetector.m in Sources */,
1E37AAD5252196CC00EBED3B /* NSData+JWT.m in Sources */,
B286B9872389DC24007833AD /* MSIDBrokerOperationGetAccountsRequest.m in Sources */,
B297E1F220A25F0C00F370EC /* MSIDLegacyTokenCacheItem.m in Sources */,
Expand Down Expand Up @@ -8372,6 +8381,7 @@
B2DD4B2720A7D67C0047A66E /* MSIDLegacyRefreshToken.m in Sources */,
1EE541412458B30300A86414 /* MSIDDevicePopManager.m in Sources */,
B27ACAA922EE9FE60049ACE0 /* MSIDIntuneApplicationStateManager.m in Sources */,
2A886D6E2ECBE3D600675D31 /* MSIDGCDStarvationDetector.m in Sources */,
B297E1E220A1272600F370EC /* MSIDLegacyTokenCacheQuery.m in Sources */,
60F7BE8B21DA4E2900F1BBA1 /* MSIDPrimaryRefreshToken.m in Sources */,
B214C39F1FE854FE0070C4F2 /* MSIDLegacyTokenCacheAccessor.m in Sources */,
Expand Down
1 change: 1 addition & 0 deletions IdentityCore/src/MSIDBrokerConstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ extern NSString * _Nonnull const MSID_IS_CALLER_MANAGED_KEY;
extern NSString * _Nonnull const MSID_BROKER_PREFERRED_AUTH_CONFIGURATION_KEY;
extern NSString * _Nonnull const MSID_BROKER_CLIENT_FLIGHTS_KEY;
extern NSString * _Nonnull const MSID_BROKER_SDM_WPJ_ATTEMPTED;
extern NSString * _Nonnull const MSID_BART_DEVICE_ID_KEY;
extern NSString * _Nonnull const MSID_EXP_RETRY_ON_NETWORK;
extern NSString * _Nonnull const MSID_EXP_ENABLE_CONNECTION_CLOSE;
extern NSString * _Nonnull const MSID_HTTP_CONNECTION;
Expand Down
1 change: 1 addition & 0 deletions IdentityCore/src/MSIDBrokerConstants.m
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@
NSString *const MSID_JIT_TROUBLESHOOTING_HOST = @"jit_troubleshooting";
NSString *const MSID_IS_CALLER_MANAGED_KEY = @"isCallerAppManaged";
NSString *const MSID_BROKER_SDM_WPJ_ATTEMPTED = @"sdm_reg_attempted";
NSString *const MSID_BART_DEVICE_ID_KEY = @"bart_device_id";
NSString *const MSID_FORCE_REFRESH_KEY = @"force_refresh";

// Experiments
Expand Down
3 changes: 3 additions & 0 deletions IdentityCore/src/MSIDConstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,9 @@ extern NSString * _Nonnull const MSID_FLIGHT_DISABLE_REMOVE_ACCOUNT_ARTIFACTS;
extern NSString * _Nonnull const MSID_FLIGHT_ENABLE_QUERYING_STK;
extern NSString * _Nonnull const MSID_FLIGHT_IS_BART_SUPPORTED;

extern NSString * _Nonnull const MSID_FLIGHT_USE_AUTOLAYOUT_FOR_LOADING_INDICATOR;

extern NSString * _Nonnull const MSID_DOMAIN_HINT_KEY;

extern NSString * _Nonnull const MSID_FLIGHT_ENABLE_THREAD_STARVATION;
#define METHODANDLINE [NSString stringWithFormat:@"%s [Line %d]", __PRETTY_FUNCTION__, __LINE__]
4 changes: 4 additions & 0 deletions IdentityCore/src/MSIDConstants.m
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,11 @@
NSString *const MSID_FLIGHT_ENABLE_QUERYING_STK = @"enable_querying_stk";
NSString *const MSID_FLIGHT_IS_BART_SUPPORTED = @"is_msal_bart_supported";

NSString *const MSID_FLIGHT_USE_AUTOLAYOUT_FOR_LOADING_INDICATOR = @"use_autolayout_for_loading_indicator";

NSString *const MSID_DOMAIN_HINT_KEY = @"domain_hint";

// This is SsoExt flow only flight
NSString *const MSID_FLIGHT_ENABLE_THREAD_STARVATION = @"ts_en";

#define METHODANDLINE [NSString stringWithFormat:@"%s [Line %d]", __PRETTY_FUNCTION__, __LINE__]
2 changes: 1 addition & 1 deletion IdentityCore/src/MSIDOAuth2Constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -180,5 +180,5 @@ extern NSString *const MSID_CCS_REQUEST_ID_RESPONSE;
extern NSString *const MSID_CCS_REQUEST_SEQUENCE_KEY;
extern NSString *const MSID_CCS_REQUEST_SEQUENCE_RESPONSE;
extern NSString *const MSID_BOUND_DEVICE_ID_CACHE_KEY;
extern NSString *const MSID_BOUND_RT_EXCHANGE;
extern NSString *const MSID_MSAL_CLIENT_APV_PREFIX;
extern NSString *const MSID_BOUND_REFRESH_TOKEN_EXCHANGE;
2 changes: 1 addition & 1 deletion IdentityCore/src/MSIDOAuth2Constants.m
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,6 @@
NSString *const MSID_CCS_REQUEST_SEQUENCE_KEY = @"x-ms-srs";
NSString *const MSID_CCS_REQUEST_SEQUENCE_RESPONSE = @"ccs-request-sequence";

NSString *const MSID_BOUND_REFRESH_TOKEN_EXCHANGE = @"bound_rt_exchange";
NSString *const MSID_BOUND_DEVICE_ID_CACHE_KEY = @"bound_device_id";
NSString *const MSID_BOUND_RT_EXCHANGE = @"bound_rt_exchange";
NSString *const MSID_MSAL_CLIENT_APV_PREFIX = @"MsalClient";
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ NS_ASSUME_NONNULL_BEGIN
- (instancetype _Nullable)initWithTokenResponse:(nonnull MSIDBrokerOperationTokenResponse *)tokenResponse;

@property (nonatomic, nullable) NSString *state;
@property (nonatomic, nullable) NSString *requestAccountUpn;
@property (nonatomic, nullable) MSIDBrokerOperationBrowserNativeMessageMATSReport *matsReport;


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ - (NSDictionary *)jsonDictionary
}

__auto_type accountJson = [NSMutableDictionary new];
accountJson[@"userName"] = tokenResponse.accountUpn;
accountJson[@"userName"] = tokenResponse.accountUpn ?: self.requestAccountUpn;
accountJson[@"id"] = tokenResponse.accountIdentifier;

response[@"account"] = accountJson;
Expand Down
5 changes: 3 additions & 2 deletions IdentityCore/src/cache/mac/MSIDMacKeychainTokenCache.m
Original file line number Diff line number Diff line change
Expand Up @@ -557,14 +557,15 @@ - (BOOL)removeAccountsWithKey:(MSIDCacheKey *)key

- (NSArray<MSIDJsonObject *> *)jsonObjectsWithKey:(__unused MSIDCacheKey *)key serializer:(__unused id<MSIDExtendedCacheItemSerializing>)serializer context:(id<MSIDRequestContext>)context error:(NSError *__autoreleasing *)error
{
[self createUnimplementedError:error context:context];
MSID_LOG_WITH_CTX(MSIDLogLevelInfo, context, @"Skipping jsonObjectsWithKey:serializer:context:error: in MSIDMacKeychainTokenCache.");
return nil;
}


- (BOOL)saveJsonObject:(__unused MSIDJsonObject *)jsonObject serializer:(__unused id<MSIDExtendedCacheItemSerializing>)serializer key:(__unused MSIDCacheKey *)key context:(id<MSIDRequestContext>)context error:(NSError *__autoreleasing *)error
{
[self createUnimplementedError:error context:context];
MSID_LOG_WITH_CTX(MSIDLogLevelInfo, context, @"Skipping saveJsonObject:serializer:key:context:error: in MSIDMacKeychainTokenCache.");

return NO;
}

Expand Down
2 changes: 2 additions & 0 deletions IdentityCore/src/oauth2/MSIDTokenResponse.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@

@property (nonatomic) BOOL createdFromCache;

@property (nonatomic, nullable) NSString *boundAppRefreshTokenDeviceId;

- (nullable instancetype)initWithJSONDictionary:(nonnull NSDictionary *)json
refreshToken:(nullable MSIDBaseToken<MSIDRefreshableToken> *)token
error:(NSError * _Nullable __autoreleasing *_Nullable)error;
Expand Down
1 change: 1 addition & 0 deletions IdentityCore/src/oauth2/MSIDTokenResponse.m
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ - (instancetype)initWithJSONDictionary:(NSDictionary *)json error:(NSError *__au
_stsErrorCodes = [json msidArrayOfIntegersForKey: MSID_OAUTH2_ERROR_CODES];
_errorDescription = [[json msidStringObjectForKey:MSID_OAUTH2_ERROR_DESCRIPTION] msidURLDecode];
_clientAppVersion = [json msidStringObjectForKey:MSID_BROKER_CLIENT_APP_VERSION_KEY];
_boundAppRefreshTokenDeviceId = [json msidStringObjectForKey:MSID_BART_DEVICE_ID_KEY];
[self setAdditionalServerInfo:json];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ - (nonnull NSMutableDictionary *)jsonDictionary
{
NSMutableDictionary *jsonDict = [NSMutableDictionary new];
jsonDict[MSID_OAUTH2_GRANT_TYPE] = MSID_OAUTH2_REFRESH_TOKEN;
jsonDict[MSID_BOUND_REFRESH_TOKEN_EXCHANGE] = @1;
jsonDict[MSID_BOUND_RT_EXCHANGE] = @1;
jsonDict[@"aud"] = self.audience;
jsonDict[@"iss"] = self.clientId; // Issuer is the client ID
NSTimeInterval now = [[NSDate date] timeIntervalSince1970];
Expand Down
6 changes: 6 additions & 0 deletions IdentityCore/src/parameters/MSIDRequestParameters.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,14 @@
#pragma mark - Xpc Mode
@property (nonatomic) MSIDXpcMode xpcMode;

#pragma mark - monitor gcd thread starvation
@property (nonatomic) BOOL allowThreadStarvationMonitoring;

- (NSURL *)tokenEndpoint;

// property that indicates if calling app requested broker for a Bound App Refresh token
@property (nonatomic) BOOL isBoundAppRefreshTokenRequested;

#pragma mark Methods
- (void)setCloudAuthorityWithCloudHostName:(NSString *)cloudHostName;
- (NSString *)allTokenRequestScopes;
Expand Down
41 changes: 39 additions & 2 deletions IdentityCore/src/requests/MSIDSilentTokenRequest.m
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@
#import "MSIDCurrentRequestTelemetry.h"
#import "MSIDAccountMetadataCacheItem.h"
#import "MSIDFlightManager.h"
#import "MSIDDefaultTokenCacheAccessor.h"
#import "MSIDAccountCredentialCache.h"
#import "MSIDKeychainTokenCache.h"

#if TARGET_OS_OSX && !EXCLUDE_FROM_MSALCPP
#import "MSIDExternalAADCacheSeeder.h"
Expand Down Expand Up @@ -277,7 +280,9 @@ - (void)executeRequestImpl:(MSIDRequestCompletionBlock)completionBlock
return;
}

[self fetchCachedTokenAndCheckForFRTFirst:NO shouldComplete:NO completionHandler:^(MSIDBaseToken<MSIDRefreshableToken> *refreshToken, MSIDRefreshTokenTypes tokenType, NSError *error) {
BOOL checkForFRTFirst = [self shouldCheckForFRTFirst];

[self fetchCachedTokenAndCheckForFRTFirst:checkForFRTFirst shouldComplete:NO completionHandler:^(MSIDBaseToken<MSIDRefreshableToken> *refreshToken, MSIDRefreshTokenTypes tokenType, NSError *error) {
if (!refreshToken)
{
NSError *interactionError = MSIDCreateError(MSIDErrorDomain, MSIDErrorInteractionRequired, @"No token matching arguments found in the cache, user interaction is required", error.msidOauthError, error.msidSubError, error, self.requestParameters.correlationId, nil, YES);
Expand Down Expand Up @@ -387,6 +392,38 @@ - (void)tryRefreshToken:(MSIDBaseToken<MSIDRefreshableToken> *)refreshToken

#pragma mark - Helpers

- (BOOL)shouldCheckForFRTFirst
{
MSIDAccountCredentialCache *accountCredentialCache = nil;

if (self.tokenCache != nil && [self.tokenCache isKindOfClass:[MSIDDefaultTokenCacheAccessor class]])
{
accountCredentialCache = ((MSIDDefaultTokenCacheAccessor *)self.tokenCache).accountCredentialCache;
}

// Use default keychain if account credential cache is not provided
if (accountCredentialCache == nil)
{
accountCredentialCache = [[MSIDAccountCredentialCache alloc] initWithDataSource:MSIDKeychainTokenCache.defaultKeychainCache];
}

NSError *frtError = nil;
MSIDIsFRTEnabledStatus frtStatus = [accountCredentialCache checkFRTEnabled:self.requestParameters error:&frtError];
BOOL frtEnabled = frtStatus == MSIDIsFRTEnabledStatusEnabled;
if (frtError)
{
// Log error, but continue to use old FRT code
MSID_LOG_WITH_CTX(MSIDLogLevelError, self.requestParameters, @"Error checking FRT enabled status, not using new FRT. Error: %@", frtError);
}
else if (frtEnabled)
{
// FRT is enabled, should try to use it first
return YES;
}

return NO;
}

- (BOOL)handleErrorResponseForAppRefreshToken:(MSIDBaseToken<MSIDRefreshableToken> *)refreshToken
completionBlock:(nonnull MSIDRequestCompletionBlock)completionBlock
{
Expand Down Expand Up @@ -486,7 +523,7 @@ - (void)acquireTokenWithRefreshTokenImpl:(MSIDBaseToken<MSIDRefreshableToken> *)
completionBlock:(MSIDRequestCompletionBlock) __unused completionBlock
{
#if !EXCLUDE_FROM_MSALCPP
MSID_LOG_WITH_CTX(MSIDLogLevelInfo, self.requestParameters, @"Acquiring Access token via Refresh token...");
MSID_LOG_WITH_CTX(MSIDLogLevelInfo, self.requestParameters, @"Acquiring Access token via %@ Refresh token...", refreshToken.credentialType == MSIDFamilyRefreshTokenType ? @"Family" : @"App");

MSIDRefreshTokenGrantRequest *tokenRequest = [self.oauthFactory refreshTokenRequestWithRequestParameters:self.requestParameters
refreshToken:refreshToken.refreshToken];
Expand Down
41 changes: 41 additions & 0 deletions IdentityCore/src/requests/broker/MSIDGCDStarvationDetector.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
//
// Copyright (c) Microsoft Corporation.
// All rights reserved.
//
// This code is licensed under the MIT License.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files(the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions :
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.


#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

@interface MSIDGCDStarvationDetector : NSObject

// Start monitoring on a dedicated thread
- (void)startMonitoring;

// Stop monitoring
// Returns the cumulative duration (in seconds) of GCD starvation detected during the monitoring period.
- (NSTimeInterval)stopMonitoring;

@end

NS_ASSUME_NONNULL_END
Loading
Loading