File tree Expand file tree Collapse file tree 3 files changed +24
-5
lines changed Expand file tree Collapse file tree 3 files changed +24
-5
lines changed Original file line number Diff line number Diff line change @@ -92,6 +92,7 @@ - (NXOAuth2Client *)oauthClient;
92
92
NSString *tokenType = [configuration objectForKey: kNXOAuth2AccountStoreConfigurationTokenType ];
93
93
NSString *keychainGroup = [configuration objectForKey: kNXOAuth2AccountStoreConfigurationTokenType ];
94
94
NSDictionary *additionalQueryParams = [configuration objectForKey: kNXOAuth2AccountStoreConfigurationAdditionalAuthenticationParameters ];
95
+ NSDictionary *customHeaderFields = [configuration objectForKey: kNXOAuth2AccountStoreConfigurationCustomHeaderFields ];
95
96
96
97
oauthClient = [[NXOAuth2Client alloc ] initWithClientID: clientID
97
98
clientSecret: clientSecret
@@ -106,6 +107,10 @@ - (NXOAuth2Client *)oauthClient;
106
107
oauthClient.additionalAuthenticationParameters = additionalQueryParams;
107
108
}
108
109
110
+ if (customHeaderFields) {
111
+ oauthClient.customHeaderFields = customHeaderFields;
112
+ }
113
+
109
114
}
110
115
}
111
116
return oauthClient;
Original file line number Diff line number Diff line change @@ -426,14 +426,13 @@ - (NXOAuth2Client *)pendingOAuthClientForAccountType:(NSString *)accountType;
426
426
NSAssert ([additionalAuthenticationParameters isKindOfClass: [NSDictionary class ]], @" additionalAuthenticationParameters have to be a NSDictionary" );
427
427
client.additionalAuthenticationParameters = additionalAuthenticationParameters;
428
428
}
429
+ if (customHeaderFields) {
430
+ client.customHeaderFields = customHeaderFields;
431
+ }
429
432
430
433
if (scope != nil ) {
431
434
client.desiredScope = scope;
432
435
}
433
-
434
- if (customHeaderFields) {
435
- client.customHeaderFields = customHeaderFields;
436
- }
437
436
438
437
[self .pendingOAuthClients setObject: client forKey: accountType];
439
438
}
@@ -517,7 +516,9 @@ - (void)oauthClientDidLoseAccessToken:(NXOAuth2Client *)client;
517
516
NSString *accountType;
518
517
@synchronized (self.pendingOAuthClients ) {
519
518
accountType = [self accountTypeOfPendingOAuthClient: client];
520
- [self .pendingOAuthClients removeObjectForKey: accountType];
519
+ if (accountType) {
520
+ [self .pendingOAuthClients removeObjectForKey: accountType];
521
+ }
521
522
}
522
523
}
523
524
Original file line number Diff line number Diff line change @@ -330,6 +330,12 @@ - (void)requestTokenWithAuthGrant:(NSString *)authGrant redirectURL:(NSURL *)red
330
330
[parameters setObject: [[self .desiredScope allObjects ] componentsJoinedByString: @" " ] forKey: @" scope" ];
331
331
}
332
332
333
+ if (self.customHeaderFields ) {
334
+ [self .customHeaderFields enumerateKeysAndObjectsUsingBlock: ^(NSString *key, NSString *obj, BOOL *stop) {
335
+ [tokenRequest addValue: obj forHTTPHeaderField: key];
336
+ }];
337
+ }
338
+
333
339
if (self.additionalAuthenticationParameters ) {
334
340
[parameters addEntriesFromDictionary: self .additionalAuthenticationParameters];
335
341
}
@@ -360,6 +366,13 @@ - (void)authenticateWithClientCredentials;
360
366
if (self.desiredScope ) {
361
367
[parameters setObject: [[self .desiredScope allObjects ] componentsJoinedByString: @" " ] forKey: @" scope" ];
362
368
}
369
+
370
+ if (self.customHeaderFields ) {
371
+ [self .customHeaderFields enumerateKeysAndObjectsUsingBlock: ^(NSString *key, NSString *obj, BOOL *stop) {
372
+ [tokenRequest addValue: obj forHTTPHeaderField: key];
373
+ }];
374
+ }
375
+
363
376
authConnection = [[NXOAuth2Connection alloc ] initWithRequest: tokenRequest
364
377
requestParameters: parameters
365
378
oauthClient: self
You can’t perform that action at this time.
0 commit comments