Skip to content

Commit

Permalink
Merge pull request #2221 from bcgov/1.10.7
Browse files Browse the repository at this point in the history
HETS-1346: Migrate sso to openshif gold
  • Loading branch information
bcgov-brwang authored Feb 9, 2023
2 parents 5e7b5c1 + 594c0cb commit 4a2acef
Show file tree
Hide file tree
Showing 12 changed files with 73 additions and 54 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
2 changes: 1 addition & 1 deletion Server/HetsApi/Controllers/CurrentUserController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ public virtual ActionResult<CurrentUserDto> 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();

Expand Down
5 changes: 3 additions & 2 deletions Server/HetsApi/Extensions/ClaimsPrincipalExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
9 changes: 7 additions & 2 deletions Server/HetsApi/Helpers/UserAccountHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
2 changes: 1 addition & 1 deletion Server/HetsApi/HetsApi.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<PropertyGroup>
<VersionPrefix>1.0.0.0</VersionPrefix>
<VersionSuffix>sprint1</VersionSuffix>
<Version>1.10.6.0</Version>
<Version>1.10.7.0</Version>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
Expand Down
2 changes: 2 additions & 0 deletions Server/HetsApi/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
using System.Linq;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Diagnostics.HealthChecks;
using Microsoft.IdentityModel.Logging;

namespace HetsApi
{
Expand All @@ -48,6 +49,7 @@ public Startup(IConfiguration configuration)

public void ConfigureServices(IServiceCollection services)
{
IdentityModelEventSource.ShowPII = true;
string connectionString = GetConnectionString();

// add http context accessor
Expand Down
6 changes: 3 additions & 3 deletions Server/HetsApi/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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/<realmid>",
"Authority": "https://dev.loginproxy.gov.bc.ca/auth/realms/<realmid>",
"Audience": "<app-id>"
},
"UploadPath": "D:\\Temp\\HETSUploads\\",
Expand Down
3 changes: 1 addition & 2 deletions Server/HetsData/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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";
}
}
Binary file modified Server/HetsReport/Templates/RentalAgreement-Template.docx
Binary file not shown.
94 changes: 53 additions & 41 deletions client/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Binary file modified openshift/secrets/sso-secrets.yaml
Binary file not shown.

0 comments on commit 4a2acef

Please sign in to comment.