Skip to content

Commit ffe0eef

Browse files
authored
Renamed tokenClaims to claims` throughout the code. (#568)
1 parent 5a0d207 commit ffe0eef

File tree

14 files changed

+211
-211
lines changed

14 files changed

+211
-211
lines changed
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,19 @@
1414
* limitations under the License.
1515
*/
1616

17-
#import "GoogleSignIn/Sources/Public/GoogleSignIn/GIDTokenClaim.h"
17+
#import "GoogleSignIn/Sources/Public/GoogleSignIn/GIDClaim.h"
1818

1919
NSString * const kAuthTimeClaimName = @"auth_time";
2020

2121
// Private interface to declare the internal initializer
22-
@interface GIDTokenClaim ()
22+
@interface GIDClaim ()
2323

2424
- (instancetype)initWithName:(NSString *)name
2525
essential:(BOOL)essential NS_DESIGNATED_INITIALIZER;
2626

2727
@end
2828

29-
@implementation GIDTokenClaim
29+
@implementation GIDClaim
3030

3131
// Private designated initializer
3232
- (instancetype)initWithName:(NSString *)name essential:(BOOL)essential {
@@ -57,12 +57,12 @@ - (BOOL)isEqual:(id)object {
5757
}
5858

5959
// 2. Check if the other object is not a GIDTokenClaim instance.
60-
if (![object isKindOfClass:[GIDTokenClaim class]]) {
60+
if (![object isKindOfClass:[GIDClaim class]]) {
6161
return NO;
6262
}
6363

6464
// 3. Compare the properties that define equality.
65-
GIDTokenClaim *other = (GIDTokenClaim *)object;
65+
GIDClaim *other = (GIDClaim *)object;
6666
return [self.name isEqualToString:other.name] &&
6767
self.isEssential == other.isEssential;
6868
}

GoogleSignIn/Sources/GIDTokenClaimsInternalOptions.h renamed to GoogleSignIn/Sources/GIDClaimsInternalOptions.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,38 +16,38 @@
1616

1717
#import <Foundation/Foundation.h>
1818

19-
@class GIDTokenClaim;
19+
@class GIDClaim;
2020

2121
NS_ASSUME_NONNULL_BEGIN
2222

23-
extern NSString *const kGIDTokenClaimErrorDescription;
24-
extern NSString *const kGIDTokenClaimEssentialPropertyKeyName;
25-
extern NSString *const kGIDTokenClaimKeyName;
23+
extern NSString *const kGIDClaimErrorDescription;
24+
extern NSString *const kGIDClaimEssentialPropertyKeyName;
25+
extern NSString *const kGIDClaimKeyName;
2626

2727
@protocol GIDJSONSerializer;
2828

2929
/**
30-
* An internal utility class for processing and serializing the `NSSet` of `GIDTokenClaim` objects
30+
* An internal utility class for processing and serializing the `NSSet` of `GIDClaim` objects
3131
* into the `JSON` format required for an `OIDAuthorizationRequest`.
3232
*/
33-
@interface GIDTokenClaimsInternalOptions : NSObject
33+
@interface GIDClaimsInternalOptions : NSObject
3434

3535
- (instancetype)init;
3636

3737
- (instancetype)initWithJSONSerializer:
3838
(id<GIDJSONSerializer>)jsonSerializer NS_DESIGNATED_INITIALIZER;
3939

4040
/**
41-
* Processes the `NSSet` of `GIDTokenClaim` objects, handling ambiguous claims,
41+
* Processes the `NSSet` of `GIDClaim` objects, handling ambiguous claims,
4242
* and returns a `JSON` string.
4343
*
44-
* @param claims The `NSSet` of `GIDTokenClaim` objects provided by the developer.
44+
* @param claims The `NSSet` of `GIDClaim` objects provided by the developer.
4545
* @param error A pointer to an `NSError` object to be populated if an error occurs (e.g., if a
4646
* claim is requested as both essential and non-essential).
4747
* @return A `JSON` string representing the claims request, or `nil` if the input is empty or an
4848
* error occurs.
4949
*/
50-
- (nullable NSString *)validatedJSONStringForClaims:(nullable NSSet<GIDTokenClaim *> *)claims
50+
- (nullable NSString *)validatedJSONStringForClaims:(nullable NSSet<GIDClaim *> *)claims
5151
error:(NSError *_Nullable *_Nullable)error;
5252

5353
@end

GoogleSignIn/Sources/GIDTokenClaimsInternalOptions.m renamed to GoogleSignIn/Sources/GIDClaimsInternalOptions.m

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -14,24 +14,24 @@
1414
* limitations under the License.
1515
*/
1616

17-
#import "GoogleSignIn/Sources/GIDTokenClaimsInternalOptions.h"
17+
#import "GoogleSignIn/Sources/GIDClaimsInternalOptions.h"
1818

1919
#import "GoogleSignIn/Sources/GIDJSONSerializer/API/GIDJSONSerializer.h"
2020
#import "GoogleSignIn/Sources/GIDJSONSerializer/Implementation/GIDJSONSerializerImpl.h"
2121
#import "GoogleSignIn/Sources/Public/GoogleSignIn/GIDSignIn.h"
22-
#import "GoogleSignIn/Sources/Public/GoogleSignIn/GIDTokenClaim.h"
22+
#import "GoogleSignIn/Sources/Public/GoogleSignIn/GIDClaim.h"
2323

24-
NSString * const kGIDTokenClaimErrorDescription =
24+
NSString * const kGIDClaimErrorDescription =
2525
@"The claim was requested as both essential and non-essential. "
2626
@"Please provide only one version.";
27-
NSString * const kGIDTokenClaimEssentialPropertyKey = @"essential";
28-
NSString * const kGIDTokenClaimKeyName = @"id_token";
27+
NSString * const kGIDClaimEssentialPropertyKey = @"essential";
28+
NSString * const kGIDClaimKeyName = @"id_token";
2929

30-
@interface GIDTokenClaimsInternalOptions ()
30+
@interface GIDClaimsInternalOptions ()
3131
@property(nonatomic, readonly) id<GIDJSONSerializer> jsonSerializer;
3232
@end
3333

34-
@implementation GIDTokenClaimsInternalOptions
34+
@implementation GIDClaimsInternalOptions
3535

3636
- (instancetype)init {
3737
return [self initWithJSONSerializer:[[GIDJSONSerializerImpl alloc] init]];
@@ -44,45 +44,45 @@ - (instancetype)initWithJSONSerializer:(id<GIDJSONSerializer>)jsonSerializer {
4444
return self;
4545
}
4646

47-
- (nullable NSString *)validatedJSONStringForClaims:(nullable NSSet<GIDTokenClaim *> *)claims
47+
- (nullable NSString *)validatedJSONStringForClaims:(nullable NSSet<GIDClaim *> *)claims
4848
error:(NSError *_Nullable *_Nullable)error {
4949
if (!claims || claims.count == 0) {
5050
return nil;
5151
}
5252

5353
// === Step 1: Check for claims with ambiguous essential property. ===
54-
NSMutableDictionary<NSString *, GIDTokenClaim *> *validTokenClaims =
54+
NSMutableDictionary<NSString *, GIDClaim *> *validClaims =
5555
[[NSMutableDictionary alloc] init];
5656

57-
for (GIDTokenClaim *currentClaim in claims) {
58-
GIDTokenClaim *existingClaim = validTokenClaims[currentClaim.name];
57+
for (GIDClaim *currentClaim in claims) {
58+
GIDClaim *existingClaim = validClaims[currentClaim.name];
5959

6060
// Check for a conflict: a claim with the same name but different essentiality.
6161
if (existingClaim && existingClaim.isEssential != currentClaim.isEssential) {
6262
if (error) {
6363
*error = [NSError errorWithDomain:kGIDSignInErrorDomain
6464
code:kGIDSignInErrorCodeAmbiguousClaims
6565
userInfo:@{
66-
NSLocalizedDescriptionKey:kGIDTokenClaimErrorDescription
66+
NSLocalizedDescriptionKey:kGIDClaimErrorDescription
6767
}];
6868
}
6969
return nil;
7070
}
71-
validTokenClaims[currentClaim.name] = currentClaim;
71+
validClaims[currentClaim.name] = currentClaim;
7272
}
7373

7474
// === Step 2: Build the dictionary structure required for OIDC JSON ===
75-
NSMutableDictionary<NSString *, NSDictionary *> *tokenClaimsDictionary =
75+
NSMutableDictionary<NSString *, NSDictionary *> *claimsDictionary =
7676
[[NSMutableDictionary alloc] init];
77-
for (GIDTokenClaim *claim in validTokenClaims.allValues) {
77+
for (GIDClaim *claim in validClaims.allValues) {
7878
if (claim.isEssential) {
79-
tokenClaimsDictionary[claim.name] = @{ kGIDTokenClaimEssentialPropertyKey: @YES };
79+
claimsDictionary[claim.name] = @{ kGIDClaimEssentialPropertyKey: @YES };
8080
} else {
81-
tokenClaimsDictionary[claim.name] = @{ kGIDTokenClaimEssentialPropertyKey: @NO };
81+
claimsDictionary[claim.name] = @{ kGIDClaimEssentialPropertyKey: @NO };
8282
}
8383
}
8484
NSDictionary<NSString *, id> *finalRequestDictionary =
85-
@{ kGIDTokenClaimKeyName: tokenClaimsDictionary };
85+
@{ kGIDClaimKeyName: claimsDictionary };
8686

8787
// === Step 3: Serialize the final dictionary into a JSON string ===
8888
return [_jsonSerializer stringWithJSONObject:finalRequestDictionary error:error];

0 commit comments

Comments
 (0)