From eb6feb7e039e3314d5ac4600fd0854e5e0c82cae Mon Sep 17 00:00:00 2001 From: Joseph Weinkam Date: Wed, 15 May 2024 10:39:12 -0700 Subject: [PATCH 1/2] Update oauth server BcscTestUser claims to include userInfo --- .../src/API/OAuthServer/Data/config.json | 2 +- .../src/API/OAuthServer/Data/test_users.json | 19 +++++++++++++++++++ oauth-server/src/API/OAuthServer/TestUsers.cs | 11 +++++++++++ 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/oauth-server/src/API/OAuthServer/Data/config.json b/oauth-server/src/API/OAuthServer/Data/config.json index 4c8b031a45..bd30e998ae 100644 --- a/oauth-server/src/API/OAuthServer/Data/config.json +++ b/oauth-server/src/API/OAuthServer/Data/config.json @@ -60,7 +60,7 @@ ] }, { - "ClientId": "test-client", + "ClientId": "dev-test-client", "ClientSecrets": [ { "Value": "EjuRF+sIxWuqxAgN+XgG157CmIANcfYcpv09mI2dg70=" diff --git a/oauth-server/src/API/OAuthServer/Data/test_users.json b/oauth-server/src/API/OAuthServer/Data/test_users.json index c8f090798e..4fa7f4658a 100644 --- a/oauth-server/src/API/OAuthServer/Data/test_users.json +++ b/oauth-server/src/API/OAuthServer/Data/test_users.json @@ -17,5 +17,24 @@ "given_name": "BCSC", "display_name": "BCSC TEST", "family_name": "TEST" + }, + { + "sub": "EVAC-1-0", + "userName": "EVAC-1-0", + "password": "autotest-1-0", + "aud": "bcsc.aud", + "birthdate": "1926-09-13", + "address": { + "street_address": "159 Smith Valley Suite 378", + "country": "CA", + "formatted": "159 Smith Valley Suite 378\nFraser Valley, BC V6R6V6", + "locality": "Fraser Valley", + "region": "BC", + "postal_code": "V6R6V6" + }, + "iss": "https://idtest.gov.bc.ca/oauth2/", + "given_name": "autotest-EVAC", + "display_name": "autotest-EVAC 1-0", + "family_name": "1-0" } ] \ No newline at end of file diff --git a/oauth-server/src/API/OAuthServer/TestUsers.cs b/oauth-server/src/API/OAuthServer/TestUsers.cs index 1ee0668b7f..6d3c2962c5 100644 --- a/oauth-server/src/API/OAuthServer/TestUsers.cs +++ b/oauth-server/src/API/OAuthServer/TestUsers.cs @@ -75,6 +75,7 @@ public class BcscTestUser public string family_name { get; set; } public Claim[] Claims => new[] { + new Claim("userInfo", JsonConvert.SerializeObject(new BcscTestUserInfo(address))), new Claim("display_name", display_name), new Claim(JwtClaimTypes.GivenName, given_name), new Claim(JwtClaimTypes.FamilyName, family_name), @@ -85,6 +86,16 @@ public class BcscTestUser }; } + public class BcscTestUserInfo + { + public BcscTestUserAddress address { get; set; } + + public BcscTestUserInfo(BcscTestUserAddress address) + { + this.address = address; + } + } + public class BcscTestUserAddress { public string street_address { get; set; } From 1508a3efc12782bd86571d5bc2b2b9c13957c9ca Mon Sep 17 00:00:00 2001 From: Joseph Weinkam Date: Wed, 15 May 2024 11:25:05 -0700 Subject: [PATCH 2/2] Add birthdate and name info to userInfo claim --- oauth-server/src/API/OAuthServer/TestUsers.cs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/oauth-server/src/API/OAuthServer/TestUsers.cs b/oauth-server/src/API/OAuthServer/TestUsers.cs index 6d3c2962c5..0f0563b083 100644 --- a/oauth-server/src/API/OAuthServer/TestUsers.cs +++ b/oauth-server/src/API/OAuthServer/TestUsers.cs @@ -75,7 +75,7 @@ public class BcscTestUser public string family_name { get; set; } public Claim[] Claims => new[] { - new Claim("userInfo", JsonConvert.SerializeObject(new BcscTestUserInfo(address))), + new Claim("userInfo", JsonConvert.SerializeObject(new BcscTestUserInfo(this))), new Claim("display_name", display_name), new Claim(JwtClaimTypes.GivenName, given_name), new Claim(JwtClaimTypes.FamilyName, family_name), @@ -89,10 +89,18 @@ public class BcscTestUser public class BcscTestUserInfo { public BcscTestUserAddress address { get; set; } + public string birthdate { get; set; } + public string given_name { get; set; } + public string display_name { get; set; } + public string family_name { get; set; } - public BcscTestUserInfo(BcscTestUserAddress address) + public BcscTestUserInfo(BcscTestUser user) { - this.address = address; + this.address = user.address; + this.birthdate = user.birthdate; + this.given_name = user.given_name; + this.display_name = user.display_name; + this.family_name = user.family_name; } }