File tree Expand file tree Collapse file tree 3 files changed +29
-1
lines changed
Expand file tree Collapse file tree 3 files changed +29
-1
lines changed Original file line number Diff line number Diff line change 1616
1717#import " GoogleSignIn/Sources/Public/GoogleSignIn/GIDClaim.h"
1818
19- NSString * const kAuthTimeClaimName = @" auth_time" ;
19+ NSString *const kAuthTimeClaimName = @" auth_time" ;
20+ NSString *const kAMRClaimName = @" amr" ;
2021
2122// Private interface to declare the internal initializer
2223@interface GIDClaim ()
@@ -48,6 +49,14 @@ + (instancetype)essentialAuthTimeClaim {
4849 return [[self alloc ] initWithName: kAuthTimeClaimName essential: YES ];
4950}
5051
52+ + (instancetype )AMRClaim {
53+ return [[self alloc ] initWithName: kAMRClaimName essential: NO ];
54+ }
55+
56+ + (instancetype )essentialAMRClaim {
57+ return [[self alloc ] initWithName: kAMRClaimName essential: YES ];
58+ }
59+
5160#pragma mark - NSObject
5261
5362- (BOOL )isEqual : (id )object {
Original file line number Diff line number Diff line change 1919NS_ASSUME_NONNULL_BEGIN
2020
2121extern NSString *const kAuthTimeClaimName ;
22+ extern NSString *const kAMRClaimName ;
2223
2324/* *
2425 * An object representing a single OIDC claim to be requested for an ID token.
@@ -42,6 +43,12 @@ extern NSString *const kAuthTimeClaimName;
4243// / Creates an *essential* "auth_time" claim object.
4344+ (instancetype )essentialAuthTimeClaim ;
4445
46+ // / Creates a *non-essential* (voluntary) "amr" claim object.
47+ + (instancetype )AMRClaim ;
48+
49+ // / Creates an *essential* "amr" claim object.
50+ + (instancetype )essentialAMRClaim ;
51+
4552@end
4653
4754NS_ASSUME_NONNULL_END
Original file line number Diff line number Diff line change @@ -33,6 +33,18 @@ - (void)testEssentialAuthTimeClaim_PropertiesAreCorrect {
3333 XCTAssertTrue (claim.isEssential );
3434}
3535
36+ - (void )testAMRClaim_PropertiesAreCorrect {
37+ GIDClaim *claim = [GIDClaim AMRClaim ];
38+ XCTAssertEqualObjects (claim.name , kAMRClaimName );
39+ XCTAssertFalse (claim.isEssential );
40+ }
41+
42+ - (void )testEssentialAMRClaim_PropertiesAreCorrect {
43+ GIDClaim *claim = [GIDClaim essentialAMRClaim ];
44+ XCTAssertEqualObjects (claim.name , kAMRClaimName );
45+ XCTAssertTrue (claim.isEssential );
46+ }
47+
3648- (void )testEquality_WithEqualClaims {
3749 GIDClaim *claim1 = [GIDClaim authTimeClaim ];
3850 GIDClaim *claim2 = [GIDClaim authTimeClaim ];
You can’t perform that action at this time.
0 commit comments