Skip to content

Commit d0d98f1

Browse files
author
Andreas Guenther
committed
Adding missing constants
1 parent 4d39b01 commit d0d98f1

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

Sources/OAuth2Client/NXOAuth2AccountStore.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ extern NSString * const kNXOAuth2AccountStoreConfigurationRedirectURL;
3535
extern NSString * const kNXOAuth2AccountStoreConfigurationScope;
3636
extern NSString * const kNXOAuth2AccountStoreConfigurationTokenType;
3737
extern NSString * const kNXOAuth2AccountStoreConfigurationTokenRequestHTTPMethod;
38-
38+
extern NSString * const kNXOAuth2AccountStoreConfigurationCustomHeaderFields;
3939

4040
/*
4141
* Requires a NSDictionary as a value.

Sources/OAuth2Client/NXOAuth2AccountStore.m

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
NSString * const kNXOAuth2AccountStoreConfigurationTokenRequestHTTPMethod = @"kNXOAuth2AccountStoreConfigurationTokenRequestHTTPMethod";
4646
NSString * const kNXOAuth2AccountStoreConfigurationKeyChainGroup = @"kNXOAuth2AccountStoreConfigurationKeyChainGroup";
4747
NSString * const kNXOAuth2AccountStoreConfigurationAdditionalAuthenticationParameters = @"kNXOAuth2AccountStoreConfigurationAdditionalAuthenticationParameters";
48+
NSString * const kNXOAuth2AccountStoreConfigurationCustomHeaderFields = @"kNXOAuth2AccountStoreConfigurationCustomHeaderFields";
4849

4950
#pragma mark Account Type
5051

@@ -404,6 +405,7 @@ - (NXOAuth2Client *)pendingOAuthClientForAccountType:(NSString *)accountType;
404405
NSString *tokenRequestHTTPMethod = [configuration objectForKey:kNXOAuth2AccountStoreConfigurationTokenRequestHTTPMethod];
405406
NSString *keychainGroup = [configuration objectForKey:kNXOAuth2AccountStoreConfigurationKeyChainGroup];
406407
NSDictionary *additionalAuthenticationParameters = [configuration objectForKey:kNXOAuth2AccountStoreConfigurationAdditionalAuthenticationParameters];
408+
NSDictionary *customHeaderFields = [configuration objectForKey:kNXOAuth2AccountStoreConfigurationCustomHeaderFields];
407409

408410
client = [[NXOAuth2Client alloc] initWithClientID:clientID
409411
clientSecret:clientSecret
@@ -428,6 +430,10 @@ - (NXOAuth2Client *)pendingOAuthClientForAccountType:(NSString *)accountType;
428430
if (scope != nil) {
429431
client.desiredScope = scope;
430432
}
433+
434+
if (customHeaderFields) {
435+
client.customHeaderFields = customHeaderFields;
436+
}
431437

432438
[self.pendingOAuthClients setObject:client forKey:accountType];
433439
}
@@ -511,9 +517,7 @@ - (void)oauthClientDidLoseAccessToken:(NXOAuth2Client *)client;
511517
NSString *accountType;
512518
@synchronized (self.pendingOAuthClients) {
513519
accountType = [self accountTypeOfPendingOAuthClient:client];
514-
if (accountType) {
515-
[self.pendingOAuthClients removeObjectForKey:accountType];
516-
}
520+
[self.pendingOAuthClients removeObjectForKey:accountType];
517521
}
518522
}
519523

@@ -606,7 +610,7 @@ + (NSDictionary *)accountsFromDefaultKeychain;
606610
result = (__bridge_transfer NSDictionary *)cfResult;
607611

608612
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);
610614
return nil;
611615
}
612616

@@ -627,7 +631,7 @@ + (void)storeAccountsInDefaultKeychain:(NSDictionary *)accounts;
627631
data, kSecAttrGeneric,
628632
nil];
629633
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);
631635
}
632636

633637
+ (void)removeFromDefaultKeychain;
@@ -638,7 +642,7 @@ + (void)removeFromDefaultKeychain;
638642
serviceName, kSecAttrService,
639643
nil];
640644
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);
642646

643647
}
644648

0 commit comments

Comments
 (0)