Skip to content

Commit 689c324

Browse files
authored
Merge pull request #1635 from AzureAD/ameyapat/save-bart-only-when-rt-type-bart
Save bound app refresh token only when rt type in token response = bart
2 parents 5d495df + 53a87de commit 689c324

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

IdentityCore/src/network/response_serializer/preprocessor/MSIDJweResponseDecryptPreProcessor.m

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#import "MSIDJweResponse.h"
2727
#import "MSIDJweResponse+EcdhAesGcm.h"
2828
#import "MSIDJsonResponsePreprocessor.h"
29+
#import "MSIDBrokerConstants.h"
2930

3031
@implementation MSIDJweResponseDecryptPreProcessor
3132

@@ -75,6 +76,12 @@ - (nullable NSDictionary *)decryptJweResponseData:(NSData *)data
7576
{
7677
NSMutableDictionary *mutableDecryptedResponse = [decryptedResponse mutableCopy];
7778
[mutableDecryptedResponse addEntriesFromDictionary:self.additionalResponseClaims];
79+
// bart_device_id should be present in response only when refresh_token_type=bound_app_rt is present in token response from server.
80+
if (![decryptedResponse[MSID_REFRESH_TOKEN_TYPE] isEqualToString:MSID_REFRESH_TOKEN_TYPE_BOUND_APP_RT])
81+
{
82+
[mutableDecryptedResponse removeObjectForKey:MSID_BART_DEVICE_ID_KEY];
83+
}
84+
7885
decryptedResponse = [mutableDecryptedResponse copy];
7986
}
8087
return decryptedResponse;

IdentityCore/src/oauth2/MSIDOauth2Factory.m

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -418,9 +418,8 @@ - (BOOL)fillAppMetadata:(MSIDAppMetadataCacheItem *)metadata
418418

419419
- (BOOL)doesResponseHaveBoundAppRefreshToken:(MSIDTokenResponse *)response
420420
{
421-
return ![NSString msidIsStringNilOrBlank:response.boundAppRefreshTokenDeviceId] &&
422-
([MSID_REFRESH_TOKEN_TYPE_BOUND_APP_RT isEqualToString:response.additionalServerInfo[MSID_REFRESH_TOKEN_TYPE]] ||
423-
[response.additionalServerInfo[MSID_BART_DEVICE_ID_KEY] length] > 0);
421+
return ![NSString msidIsStringNilOrBlank:response.boundAppRefreshTokenDeviceId] ||
422+
[response.additionalServerInfo[MSID_BART_DEVICE_ID_KEY] length] > 0;
424423
}
425424

426425
#pragma mark - Webview

changelog.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
TBD
2+
* Add logic to save bound app RT only when token response has refresh_token_type=bound_app_rt
3+
14
Version 1.18.0
25
* Silent token request should use FRT first when single FRT is enabled #1624
36
* Use autolayout for loading indicator #1628

0 commit comments

Comments
 (0)