45
45
NSString * const kNXOAuth2AccountStoreConfigurationTokenRequestHTTPMethod = @" kNXOAuth2AccountStoreConfigurationTokenRequestHTTPMethod" ;
46
46
NSString * const kNXOAuth2AccountStoreConfigurationKeyChainGroup = @" kNXOAuth2AccountStoreConfigurationKeyChainGroup" ;
47
47
NSString * const kNXOAuth2AccountStoreConfigurationAdditionalAuthenticationParameters = @" kNXOAuth2AccountStoreConfigurationAdditionalAuthenticationParameters" ;
48
+ NSString * const kNXOAuth2AccountStoreConfigurationCustomHeaderFields = @" kNXOAuth2AccountStoreConfigurationCustomHeaderFields" ;
48
49
49
50
#pragma mark Account Type
50
51
@@ -404,6 +405,7 @@ - (NXOAuth2Client *)pendingOAuthClientForAccountType:(NSString *)accountType;
404
405
NSString *tokenRequestHTTPMethod = [configuration objectForKey: kNXOAuth2AccountStoreConfigurationTokenRequestHTTPMethod ];
405
406
NSString *keychainGroup = [configuration objectForKey: kNXOAuth2AccountStoreConfigurationKeyChainGroup ];
406
407
NSDictionary *additionalAuthenticationParameters = [configuration objectForKey: kNXOAuth2AccountStoreConfigurationAdditionalAuthenticationParameters ];
408
+ NSDictionary *customHeaderFields = [configuration objectForKey: kNXOAuth2AccountStoreConfigurationCustomHeaderFields ];
407
409
408
410
client = [[NXOAuth2Client alloc ] initWithClientID: clientID
409
411
clientSecret: clientSecret
@@ -428,6 +430,10 @@ - (NXOAuth2Client *)pendingOAuthClientForAccountType:(NSString *)accountType;
428
430
if (scope != nil ) {
429
431
client.desiredScope = scope;
430
432
}
433
+
434
+ if (customHeaderFields) {
435
+ client.customHeaderFields = customHeaderFields;
436
+ }
431
437
432
438
[self .pendingOAuthClients setObject: client forKey: accountType];
433
439
}
@@ -511,9 +517,7 @@ - (void)oauthClientDidLoseAccessToken:(NXOAuth2Client *)client;
511
517
NSString *accountType;
512
518
@synchronized (self.pendingOAuthClients ) {
513
519
accountType = [self accountTypeOfPendingOAuthClient: client];
514
- if (accountType) {
515
- [self .pendingOAuthClients removeObjectForKey: accountType];
516
- }
520
+ [self .pendingOAuthClients removeObjectForKey: accountType];
517
521
}
518
522
}
519
523
@@ -606,7 +610,7 @@ + (NSDictionary *)accountsFromDefaultKeychain;
606
610
result = (__bridge_transfer NSDictionary *)cfResult;
607
611
608
612
if (status != noErr) {
609
- NSAssert1 (status == errSecItemNotFound, @" Unexpected error while fetching accounts from keychain: %d " , ( int ) status);
613
+ NSAssert1 (status == errSecItemNotFound, @" Unexpected error while fetching accounts from keychain: %ld " , status);
610
614
return nil ;
611
615
}
612
616
@@ -627,7 +631,7 @@ + (void)storeAccountsInDefaultKeychain:(NSDictionary *)accounts;
627
631
data, kSecAttrGeneric ,
628
632
nil ];
629
633
OSStatus __attribute__ ((unused)) err = SecItemAdd ((__bridge CFDictionaryRef)query, NULL );
630
- NSAssert1 (err == noErr, @" Error while adding token to keychain: %d " , ( int ) err);
634
+ NSAssert1 (err == noErr, @" Error while adding token to keychain: %ld " , err);
631
635
}
632
636
633
637
+ (void )removeFromDefaultKeychain ;
@@ -638,7 +642,7 @@ + (void)removeFromDefaultKeychain;
638
642
serviceName, kSecAttrService ,
639
643
nil ];
640
644
OSStatus __attribute__ ((unused)) err = SecItemDelete ((__bridge CFDictionaryRef)query);
641
- NSAssert1 ((err == noErr || err == errSecItemNotFound), @"Error while deleting token from keychain: ld", ( int ) err);
645
+ NSAssert1 ((err == noErr || err == errSecItemNotFound), @"Error while deleting token from keychain: % ld", err);
642
646
643
647
}
644
648
0 commit comments