Skip to content

Commit cc1b639

Browse files
authored
Update Claim Actions for QuickBooks OpenID (#727)
* Update Claim Actions for QuickBooks OpenID * Update test fixture for QuickBooks claims update
1 parent 0f32bcf commit cc1b639

File tree

4 files changed

+14
-4
lines changed

4 files changed

+14
-4
lines changed

src/AspNet.Security.OAuth.QuickBooks/QuickBooksAuthenticationConstants.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,6 @@ public static class Claims
1515
{
1616
public const string AccountType = "urn:quickbooks:appenvrionment";
1717
public const string EmailVerified = "urn:quickbooks:email_verified";
18+
public const string PhoneNumberVerified = "urn:quickbooks:phone_number_verified";
1819
}
1920
}

src/AspNet.Security.OAuth.QuickBooks/QuickBooksAuthenticationOptions.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,11 @@ public QuickBooksAuthenticationOptions()
2929
Scope.Add("email");
3030

3131
ClaimActions.MapJsonKey(ClaimTypes.NameIdentifier, "sub");
32-
ClaimActions.MapJsonKey(ClaimTypes.MobilePhone, "mobilephone");
32+
ClaimActions.MapJsonKey(ClaimTypes.OtherPhone, "phoneNumber");
33+
ClaimActions.MapJsonKey(Claims.PhoneNumberVerified, "phoneNumberVerified");
3334
ClaimActions.MapJsonKey(ClaimTypes.Email, "email");
3435
ClaimActions.MapJsonKey(Claims.EmailVerified, "emailVerified");
36+
ClaimActions.MapJsonKey(ClaimTypes.GivenName, "givenName");
37+
ClaimActions.MapJsonKey(ClaimTypes.Surname, "familyName");
3538
}
3639
}

test/AspNet.Security.OAuth.Providers.Tests/QuickBooks/QuickBooksTests.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,12 @@ protected internal override void RegisterAuthentication(AuthenticationBuilder bu
2828

2929
[Theory]
3030
[InlineData(ClaimTypes.NameIdentifier, "2039290222")]
31-
[InlineData(ClaimTypes.MobilePhone, "(314)000-0000")]
31+
[InlineData(ClaimTypes.OtherPhone, "(314)000-0000")]
32+
[InlineData(Claims.PhoneNumberVerified, "true")]
3233
[InlineData(ClaimTypes.Email, "[email protected]")]
3334
[InlineData(Claims.EmailVerified, "true")]
35+
[InlineData(ClaimTypes.GivenName, "John")]
36+
[InlineData(ClaimTypes.Surname, "Smith")]
3437
public async Task Can_Sign_In_Using_QuickBooks(string claimType, string claimValue)
3538
{
3639
// Arrange

test/AspNet.Security.OAuth.Providers.Tests/QuickBooks/bundle.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,12 @@
1717
"contentFormat": "json",
1818
"contentJson": {
1919
"sub": "2039290222",
20-
"mobilephone": "(314)000-0000",
20+
"phoneNumber": "(314)000-0000",
21+
"phoneNumberVerified": "true",
2122
"email": "[email protected]",
22-
"emailVerified": "true"
23+
"emailVerified": "true",
24+
"givenName": "John",
25+
"familyName": "Smith"
2326
}
2427
}
2528
]

0 commit comments

Comments
 (0)