Skip to content

Commit

Permalink
Add doc comments and constants to build access group
Browse files Browse the repository at this point in the history
  • Loading branch information
mdmathias committed Jan 29, 2024
1 parent 841d54a commit e6630b4
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions Examples/Example-macOS/Source/GTMAppAuthExampleViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,16 @@

#import "AppDelegate.h"

/*! @brief The bundle ID will use in constructing the app group string for keychain queries.
@discussion The string here is a combination of this example app's bundle ID and the keychain
access group name added in the app's entitlements file.
*/
static NSString *kBundleIDAccessGroup = @"com.example.GTMAppAuth.Example-macOS.test-group";

/*! @brief The team ID you will use in constructing the app group string for keychain queries.
@discussion The team ID you will use can be found in your developer team profile page on
developer.apple.com.
*/
static NSString *const kTeamIDPrefix = @"YOUR_TEAM_ID";

/*! @brief The OIDC issuer from which the configuration will be discovered.
Expand Down Expand Up @@ -68,8 +78,7 @@ - (void)viewDidLoad {
[super viewDidLoad];

GTMKeychainAttribute *dataProtection = [GTMKeychainAttribute useDataProtectionKeychain];
NSString *bundleID = @"com.example.GTMAppAuth.Example-macOS.test-group";
NSString *testGroup = [NSString stringWithFormat:@"%@.%@", kTeamIDPrefix, bundleID];
NSString *testGroup = [NSString stringWithFormat:@"%@.%@", kTeamIDPrefix, kBundleIDAccessGroup];
GTMKeychainAttribute *accessGroup = [GTMKeychainAttribute keychainAccessGroupWithName:testGroup];
NSSet *attributes = [NSSet setWithArray:@[dataProtection, accessGroup]];
self.keychainStore = [[GTMKeychainStore alloc] initWithItemName:kExampleAuthorizerKey
Expand Down

0 comments on commit e6630b4

Please sign in to comment.