diff --git a/README.md b/README.md index afb55e5e..d17472c3 100644 --- a/README.md +++ b/README.md @@ -78,4 +78,4 @@ Please note that this project is released with a [Contributor Code of Conduct](C ## Maintenance This repository is maintained by [BC Ministry of Transportation](http://www.th.gov.bc.ca/). -Click [here](https://github.com/orgs/bcgov/teams/tran/repositories) for a complete list of our repositories on GitHub. +Click [here](https://github.com/orgs/bcgov/teams/tran/repositories) for a complete list of our repositories on GitHub. \ No newline at end of file diff --git a/Server/HetsApi/Controllers/CurrentUserController.cs b/Server/HetsApi/Controllers/CurrentUserController.cs index 08e5a2ad..935c5d1e 100644 --- a/Server/HetsApi/Controllers/CurrentUserController.cs +++ b/Server/HetsApi/Controllers/CurrentUserController.cs @@ -149,7 +149,7 @@ public virtual ActionResult UsersCurrentGet() _logger.LogDebug("Business Guid: {0}", businessGuid); // not found - return an HTTP 401 error response - if (string.IsNullOrEmpty(userId)) return StatusCode(401); + if (string.IsNullOrEmpty(userId) && string.IsNullOrEmpty(businessGuid)) return StatusCode(401); CurrentUserDto user = new CurrentUserDto(); diff --git a/Server/HetsApi/Extensions/ClaimsPrincipalExtensions.cs b/Server/HetsApi/Extensions/ClaimsPrincipalExtensions.cs index 6418f286..3ff884af 100644 --- a/Server/HetsApi/Extensions/ClaimsPrincipalExtensions.cs +++ b/Server/HetsApi/Extensions/ClaimsPrincipalExtensions.cs @@ -10,10 +10,11 @@ public static (string username, string userGuid, string directory, string bizGui var preferredUsername = principal.FindFirstValue("preferred_username"); var usernames = preferredUsername?.Split("@"); - var username = usernames?[0].ToUpperInvariant(); + var username = principal.FindFirstValue("idir_username"); var directory = usernames?[1].ToUpperInvariant(); - var userGuidClaim = directory == Constants.IDIR ? "idir_userid" : "bceid_userid"; + var userGuidClaim = directory == Constants.IDIR ? "idir_user_guid" : "bceid_user_guid"; + var userGuid = principal.FindFirstValue(userGuidClaim)?.ToUpperInvariant(); var bizGuid = directory == Constants.IDIR ? "" : principal.FindFirstValue("bceid_business_guid"); diff --git a/Server/HetsApi/Helpers/UserAccountHelper.cs b/Server/HetsApi/Helpers/UserAccountHelper.cs index 022f15db..9f825d9a 100644 --- a/Server/HetsApi/Helpers/UserAccountHelper.cs +++ b/Server/HetsApi/Helpers/UserAccountHelper.cs @@ -277,8 +277,13 @@ public static HetBusinessUser GetBusinessUser(DbAppContext context, string usern } // ok - now find the user - HetBusinessUser user = context.HetBusinessUsers - .FirstOrDefault(x => x.BceidGuid.ToLower() == guid.ToLower()); + HetBusinessUser user = null; + if (guid != null) + { + context.HetBusinessUsers + .FirstOrDefault(x => x.BceidGuid.ToLower() == guid.ToLower()); + } + if (user == null) { diff --git a/Server/HetsApi/HetsApi.csproj b/Server/HetsApi/HetsApi.csproj index c1d8c351..a9d784a3 100644 --- a/Server/HetsApi/HetsApi.csproj +++ b/Server/HetsApi/HetsApi.csproj @@ -12,7 +12,7 @@ 1.0.0.0 sprint1 - 1.10.6.0 + 1.10.7.0 diff --git a/Server/HetsApi/Startup.cs b/Server/HetsApi/Startup.cs index b704eabf..4f105833 100644 --- a/Server/HetsApi/Startup.cs +++ b/Server/HetsApi/Startup.cs @@ -31,6 +31,7 @@ using System.Linq; using Microsoft.AspNetCore.Http; using Microsoft.Extensions.Diagnostics.HealthChecks; +using Microsoft.IdentityModel.Logging; namespace HetsApi { @@ -48,6 +49,7 @@ public Startup(IConfiguration configuration) public void ConfigureServices(IServiceCollection services) { + IdentityModelEventSource.ShowPII = true; string connectionString = GetConnectionString(); // add http context accessor diff --git a/Server/HetsApi/appsettings.json b/Server/HetsApi/appsettings.json index aba26f44..5b1fc2d9 100644 --- a/Server/HetsApi/appsettings.json +++ b/Server/HetsApi/appsettings.json @@ -13,8 +13,8 @@ "LogoffUrl-Training": "https://logontest.gov.bc.ca/clp-cgi/logoff.cgi?returl=https://trn-hets.th.gov.bc.ca&retnow=1", "LogoffUrl-UAT": "https://logontest.gov.bc.ca/clp-cgi/logoff.cgi?returl=https://uat-hets.th.gov.bc.ca&retnow=1", "LogoffUrl-Production": "https://logon.gov.bc.ca/clp-cgi/logoff.cgi?returl=https://hets.th.gov.bc.ca&retnow=1", - "Version-Application": "Release 1.10.6.0", - "Version-Database": "Release 1.10.6.0", + "Version-Application": "Release 1.10.7.0", + "Version-Database": "Release 1.10.7.0", "Maximum-Blank-Agreements": "3", "ExceptionDescriptions": { "HETS-01": "Record not found", @@ -88,7 +88,7 @@ "HETS": "Host=localhost;Username=postgres;Password=postgres;Database=hets;Port=9000;" }, "JWT": { - "Authority": "https://dev.oidc.gov.bc.ca/auth/realms/", + "Authority": "https://dev.loginproxy.gov.bc.ca/auth/realms/", "Audience": "" }, "UploadPath": "D:\\Temp\\HETSUploads\\", diff --git a/Server/HetsData/Constants.cs b/Server/HetsData/Constants.cs index e03def62..c690bf67 100644 --- a/Server/HetsData/Constants.cs +++ b/Server/HetsData/Constants.cs @@ -9,8 +9,7 @@ public class Constants public const string InvalidPermissions = "HETS UserId does not have valid permissions"; public const string MissingBusinessIdError = "Invalid Business Record"; public const string InvalidDirectory = "Invalid Directory"; - public const string IDIR = "IDIR"; - public const string BCEIDBIZ = "BCEID-BUSINESS"; + public const string BCEIDBIZ = "BCEIDBUSINESS"; } } diff --git a/Server/HetsReport/Templates/RentalAgreement-Template.docx b/Server/HetsReport/Templates/RentalAgreement-Template.docx index 29d95090..b31b144a 100644 Binary files a/Server/HetsReport/Templates/RentalAgreement-Template.docx and b/Server/HetsReport/Templates/RentalAgreement-Template.docx differ diff --git a/client/package-lock.json b/client/package-lock.json index dbe3c4ab..41ac87f9 100644 --- a/client/package-lock.json +++ b/client/package-lock.json @@ -20,7 +20,7 @@ "file-saver": "^2.0.5", "http-proxy-middleware": "^2.0.0", "immer": "^9.0.6", - "keycloak-js": "^13.0.1", + "keycloak-js": "^19.0.2", "lodash": "^4.17.21", "moment": "^2.22.2", "react": "^17.0.2", @@ -5389,6 +5389,25 @@ "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", "dev": true }, + "node_modules/base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, "node_modules/batch": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/batch/-/batch-0.6.1.tgz", @@ -12361,9 +12380,9 @@ } }, "node_modules/jquery": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.6.0.tgz", - "integrity": "sha512-JVzAR/AjBvVt2BmYhxRCSYysDsPcssdmTFnzyLEts9qNwmjmu4JTAMYubEfwVOSwpQ1I1sKKFcxhZCI2buerfw==", + "version": "3.6.1", + "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.6.1.tgz", + "integrity": "sha512-opJeO4nCucVnsjiXOE+/PcCgYw9Gwpvs/a6B1LL/lQhwWwpbVEVYDZ1FokFr8PRc7ghYlrFPuyHuiiDNTQxmcw==", "peer": true }, "node_modules/js-base64": { @@ -12551,19 +12570,14 @@ } }, "node_modules/keycloak-js": { - "version": "13.0.1", - "resolved": "https://registry.npmjs.org/keycloak-js/-/keycloak-js-13.0.1.tgz", - "integrity": "sha512-S9mFX8HHlgw+i2HAIhteccrkffQmUn4CpYcU8ViGnODSBcnaf2YTtLhiiRH/a6SaOBpxmJTN3XVIZbE9d/HyXQ==", + "version": "19.0.2", + "resolved": "https://registry.npmjs.org/keycloak-js/-/keycloak-js-19.0.2.tgz", + "integrity": "sha512-tQjkLVVIwaV1xf4Fri5u+d+Ttddrh0S5cv3ltG+uTUd7WNwt5LkOXsPnqWQjj9stpoBTFgTuzIqJ2C6vk0CcEQ==", "dependencies": { - "base64-js": "1.3.1", - "js-sha256": "0.9.0" + "base64-js": "^1.5.1", + "js-sha256": "^0.9.0" } }, - "node_modules/keycloak-js/node_modules/base64-js": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.3.1.tgz", - "integrity": "sha512-mLQ4i2QO1ytvGWFWmcngKO//JXAQueZvwEKtjgQFM4jIK0kU+ytMfplL8j+n5mspOfjHwoAg+9yhb7BwAHm36g==" - }, "node_modules/kind-of": { "version": "6.0.3", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", @@ -16261,9 +16275,9 @@ } }, "node_modules/react-scripts/node_modules/type-fest": { - "version": "2.13.1", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-2.13.1.tgz", - "integrity": "sha512-hXYyrPFwETT2swFLHeoKtJrvSF/ftG/sA15/8nGaLuaDGfVAaq8DYFpu4yOyV4tzp082WqnTEoMsm3flKMI2FQ==", + "version": "2.19.0", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-2.19.0.tgz", + "integrity": "sha512-RAH822pAdBgcNMAfWnCBU3CFZcfZ/i1eZjwFU/dsLKumyuuP3niueg2UAukXYF0E2AAoc82ZSSf9J0WQBinzHA==", "dev": true, "optional": true, "peer": true, @@ -18439,9 +18453,9 @@ } }, "node_modules/typescript": { - "version": "4.7.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.7.3.tgz", - "integrity": "sha512-WOkT3XYvrpXx4vMMqlD+8R8R37fZkjyLGlxavMc4iB8lrl8L0DeTcHbYgw/v0N/z9wAFsgBhcsF0ruoySS22mA==", + "version": "4.8.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.8.3.tgz", + "integrity": "sha512-goMHfm00nWPa8UvR/CPSvykqf6dVV8x/dp0c5mFTMTIu0u0FlGWRioyy7Nn0PGAdHxpJZnuO/ut+PpQ8UiHAig==", "dev": true, "peer": true, "bin": { @@ -23624,6 +23638,11 @@ "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", "dev": true }, + "base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==" + }, "batch": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/batch/-/batch-0.6.1.tgz", @@ -28917,9 +28936,9 @@ } }, "jquery": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.6.0.tgz", - "integrity": "sha512-JVzAR/AjBvVt2BmYhxRCSYysDsPcssdmTFnzyLEts9qNwmjmu4JTAMYubEfwVOSwpQ1I1sKKFcxhZCI2buerfw==", + "version": "3.6.1", + "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.6.1.tgz", + "integrity": "sha512-opJeO4nCucVnsjiXOE+/PcCgYw9Gwpvs/a6B1LL/lQhwWwpbVEVYDZ1FokFr8PRc7ghYlrFPuyHuiiDNTQxmcw==", "peer": true }, "js-base64": { @@ -29070,19 +29089,12 @@ } }, "keycloak-js": { - "version": "13.0.1", - "resolved": "https://registry.npmjs.org/keycloak-js/-/keycloak-js-13.0.1.tgz", - "integrity": "sha512-S9mFX8HHlgw+i2HAIhteccrkffQmUn4CpYcU8ViGnODSBcnaf2YTtLhiiRH/a6SaOBpxmJTN3XVIZbE9d/HyXQ==", + "version": "19.0.2", + "resolved": "https://registry.npmjs.org/keycloak-js/-/keycloak-js-19.0.2.tgz", + "integrity": "sha512-tQjkLVVIwaV1xf4Fri5u+d+Ttddrh0S5cv3ltG+uTUd7WNwt5LkOXsPnqWQjj9stpoBTFgTuzIqJ2C6vk0CcEQ==", "requires": { - "base64-js": "1.3.1", - "js-sha256": "0.9.0" - }, - "dependencies": { - "base64-js": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.3.1.tgz", - "integrity": "sha512-mLQ4i2QO1ytvGWFWmcngKO//JXAQueZvwEKtjgQFM4jIK0kU+ytMfplL8j+n5mspOfjHwoAg+9yhb7BwAHm36g==" - } + "base64-js": "^1.5.1", + "js-sha256": "^0.9.0" } }, "kind-of": { @@ -31682,9 +31694,9 @@ "dev": true }, "type-fest": { - "version": "2.13.1", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-2.13.1.tgz", - "integrity": "sha512-hXYyrPFwETT2swFLHeoKtJrvSF/ftG/sA15/8nGaLuaDGfVAaq8DYFpu4yOyV4tzp082WqnTEoMsm3flKMI2FQ==", + "version": "2.19.0", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-2.19.0.tgz", + "integrity": "sha512-RAH822pAdBgcNMAfWnCBU3CFZcfZ/i1eZjwFU/dsLKumyuuP3niueg2UAukXYF0E2AAoc82ZSSf9J0WQBinzHA==", "dev": true, "optional": true, "peer": true @@ -33395,9 +33407,9 @@ } }, "typescript": { - "version": "4.7.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.7.3.tgz", - "integrity": "sha512-WOkT3XYvrpXx4vMMqlD+8R8R37fZkjyLGlxavMc4iB8lrl8L0DeTcHbYgw/v0N/z9wAFsgBhcsF0ruoySS22mA==", + "version": "4.8.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.8.3.tgz", + "integrity": "sha512-goMHfm00nWPa8UvR/CPSvykqf6dVV8x/dp0c5mFTMTIu0u0FlGWRioyy7Nn0PGAdHxpJZnuO/ut+PpQ8UiHAig==", "dev": true, "peer": true }, diff --git a/client/package.json b/client/package.json index 44e46228..3de6716c 100644 --- a/client/package.json +++ b/client/package.json @@ -15,7 +15,7 @@ "file-saver": "^2.0.5", "http-proxy-middleware": "^2.0.0", "immer": "^9.0.6", - "keycloak-js": "^13.0.1", + "keycloak-js": "^19.0.2", "lodash": "^4.17.21", "moment": "^2.22.2", "react": "^17.0.2", diff --git a/openshift/secrets/sso-secrets.yaml b/openshift/secrets/sso-secrets.yaml index 9518a44d..bb4e5d13 100644 Binary files a/openshift/secrets/sso-secrets.yaml and b/openshift/secrets/sso-secrets.yaml differ