File tree Expand file tree Collapse file tree 8 files changed +26
-0
lines changed
Expand file tree Collapse file tree 8 files changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -99,6 +99,7 @@ extern NSString * _Nonnull const MSID_IS_CALLER_MANAGED_KEY;
9999extern NSString * _Nonnull const MSID_BROKER_PREFERRED_AUTH_CONFIGURATION_KEY ;
100100extern NSString * _Nonnull const MSID_BROKER_CLIENT_FLIGHTS_KEY ;
101101extern NSString * _Nonnull const MSID_BROKER_SDM_WPJ_ATTEMPTED ;
102+ extern NSString * _Nonnull const MSID_BART_DEVICE_ID_KEY ;
102103extern NSString * _Nonnull const MSID_EXP_RETRY_ON_NETWORK ;
103104extern NSString * _Nonnull const MSID_EXP_ENABLE_CONNECTION_CLOSE ;
104105extern NSString * _Nonnull const MSID_HTTP_CONNECTION ;
Original file line number Diff line number Diff line change 9797NSString *const MSID_JIT_TROUBLESHOOTING_HOST = @" jit_troubleshooting" ;
9898NSString *const MSID_IS_CALLER_MANAGED_KEY = @" isCallerAppManaged" ;
9999NSString *const MSID_BROKER_SDM_WPJ_ATTEMPTED = @" sdm_reg_attempted" ;
100+ NSString *const MSID_BART_DEVICE_ID_KEY = @" bart_device_id" ;
100101NSString *const MSID_FORCE_REFRESH_KEY = @" force_refresh" ;
101102
102103// Experiments
Original file line number Diff line number Diff line change @@ -179,4 +179,6 @@ extern NSString *const MSID_CCS_REQUEST_ID_RESPONSE;
179179
180180extern NSString * const MSID_CCS_REQUEST_SEQUENCE_KEY ;
181181extern NSString * const MSID_CCS_REQUEST_SEQUENCE_RESPONSE ;
182+ extern NSString * const MSID_REFRESH_TOKEN_TYPE ;
183+ extern NSString * const MSID_REFRESH_TOKEN_TYPE_BOUND_APP_RT ;
182184extern NSString * const MSID_BOUND_DEVICE_ID_CACHE_KEY ;
Original file line number Diff line number Diff line change 180180NSString *const MSID_CCS_REQUEST_SEQUENCE_KEY = @" x-ms-srs" ;
181181NSString *const MSID_CCS_REQUEST_SEQUENCE_RESPONSE = @" ccs-request-sequence" ;
182182
183+ NSString *const MSID_REFRESH_TOKEN_TYPE = @" refresh_token_type" ;
184+ NSString *const MSID_REFRESH_TOKEN_TYPE_BOUND_APP_RT = @" bound_app_rt" ;
183185NSString *const MSID_BOUND_DEVICE_ID_CACHE_KEY = @" bound_device_id" ;
Original file line number Diff line number Diff line change 2727#import " MSIDAccessToken.h"
2828#import " MSIDBaseToken.h"
2929#import " MSIDRefreshToken.h"
30+ #import " MSIDBoundRefreshToken.h"
3031#import " MSIDLegacySingleResourceToken.h"
3132#import " MSIDIdToken.h"
3233#import " MSIDAccount.h"
@@ -170,6 +171,15 @@ - (MSIDRefreshToken *)refreshTokenFromResponse:(MSIDTokenResponse *)response
170171 BOOL result = [self fillRefreshToken: refreshToken fromResponse: response configuration: configuration];
171172
172173 if (!result) return nil ;
174+ if (refreshToken)
175+ {
176+ // Saving RT from a token network response
177+ if ([response.additionalServerInfo[MSID_REFRESH_TOKEN_TYPE] isEqualToString: MSID_REFRESH_TOKEN_TYPE_BOUND_APP_RT])
178+ {
179+ MSIDBoundRefreshToken *bart = [[MSIDBoundRefreshToken alloc ] initWithRefreshToken: refreshToken boundDeviceId: response.boundAppRefreshTokenDeviceId];
180+ return bart;
181+ }
182+ }
173183 return refreshToken;
174184}
175185
Original file line number Diff line number Diff line change 9595
9696@property (nonatomic ) BOOL createdFromCache;
9797
98+ @property (nonatomic , nullable ) NSString *boundAppRefreshTokenDeviceId;
99+
98100- (nullable instancetype )initWithJSONDictionary : (nonnull NSDictionary *)json
99101 refreshToken : (nullable MSIDBaseToken<MSIDRefreshableToken> *)token
100102 error : (NSError * _Nullable __autoreleasing *_Nullable)error ;
Original file line number Diff line number Diff line change @@ -170,6 +170,7 @@ - (instancetype)initWithJSONDictionary:(NSDictionary *)json error:(NSError *__au
170170 _stsErrorCodes = [json msidArrayOfIntegersForKey: MSID_OAUTH2_ERROR_CODES];
171171 _errorDescription = [[json msidStringObjectForKey: MSID_OAUTH2_ERROR_DESCRIPTION] msidURLDecode ];
172172 _clientAppVersion = [json msidStringObjectForKey: MSID_BROKER_CLIENT_APP_VERSION_KEY];
173+ _boundAppRefreshTokenDeviceId = [json msidStringObjectForKey: MSID_BART_DEVICE_ID_KEY];
173174 [self setAdditionalServerInfo: json];
174175 }
175176
Original file line number Diff line number Diff line change 2929#import " MSIDBrokerResponse.h"
3030#import " MSIDAccessToken.h"
3131#import " MSIDRefreshToken.h"
32+ #import " MSIDBoundRefreshToken.h"
3233#import " MSIDBasicContext.h"
3334#import " MSIDAccountMetadataCacheAccessor.h"
3435#import " MSIDAccountIdentifier.h"
@@ -261,6 +262,12 @@ - (MSIDTokenResult *)validateAndSaveTokenResponse:(MSIDTokenResponse *)tokenResp
261262 return nil ;
262263 }
263264
265+ if ([tokenResponse.additionalServerInfo[MSID_REFRESH_TOKEN_TYPE] isEqualToString: MSID_REFRESH_TOKEN_TYPE_BOUND_APP_RT] && tokenResponse.boundAppRefreshTokenDeviceId )
266+ {
267+ tokenResult.refreshToken = [[MSIDBoundRefreshToken alloc ] initWithRefreshToken: (MSIDRefreshToken *)tokenResult.refreshToken
268+ boundDeviceId: tokenResponse.boundAppRefreshTokenDeviceId];
269+ }
270+
264271 // save metadata
265272 NSError *authorityError;
266273 MSIDAuthority *resultingAuthority = [factory resultAuthorityWithConfiguration: parameters.msidConfiguration tokenResponse: tokenResponse error: &authorityError];
You can’t perform that action at this time.
0 commit comments