Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keycloak Refactor #3624

Merged
merged 3 commits into from
Dec 1, 2023
Merged

Conversation

FuriousLlama
Copy link
Collaborator

Refactored keycloak sync to use the keycloak repository used by the aPI.

ALso removed tools.Core and removed redundant models

…PI. ALso removed tools.Core and removed redundant models
@FuriousLlama FuriousLlama added the tech-debt Removing technical debt label Nov 30, 2023
@FuriousLlama FuriousLlama self-assigned this Nov 30, 2023
Copy link
Contributor

✅ No secrets were detected in the code.

Copy link

codecov bot commented Nov 30, 2023

Codecov Report

Merging #3624 (c62c9b1) into dev (9be0933) will decrease coverage by 6.06%.
The diff coverage is 83.33%.

❗ Current head c62c9b1 differs from pull request most recent head 138f672. Consider uploading reports for the commit 138f672 to get more accurate results

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##              dev    #3624      +/-   ##
==========================================
- Coverage   69.51%   63.45%   -6.06%     
==========================================
  Files        1375      474     -901     
  Lines       34362    15415   -18947     
  Branches     6486     1059    -5427     
==========================================
- Hits        23886     9782   -14104     
+ Misses      10216     5373    -4843     
  Partials      260      260              
Flag Coverage Δ
unittests 63.45% <83.33%> (-6.06%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
...keycloak/Extensions/ServiceCollectionExtensions.cs 100.00% <100.00%> (ø)
source/backend/dal.keycloak/PimsKeycloakService.cs 100.00% <100.00%> (ø)
...keycloak/Extensions/ServiceCollectionExtensions.cs 100.00% <100.00%> (ø)
source/backend/keycloak/KeycloakRepository.cs 78.57% <78.57%> (ø)

... and 901 files with indirect coverage changes

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was actually renamed to IKeycloackRepository.cs same with the implementation file

@@ -15,7 +15,7 @@ public class RoleModel
/// <summary>
/// get/set - whether or not this role is a composite role.
/// </summary>
public bool Composite { get; set; }
public bool? Composite { get; set; }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this incorrect in the current implementation?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was inconsistent between the two models

@@ -23,7 +22,7 @@ public class SyncFactory : ISyncFactory
{
#region Variables
private static readonly int MAXPAGES = 20;
private readonly IKeycloakRequestClient _keycloakManagementClient;
private readonly IKeycloakRepository _keycloakService;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: _keycloakRepository

{
throw new HttpClientRequestException(kresponse, $"Failed to add the role '{claim.Name}' to keycloak.");
throw new HttpClientRequestException(respose, $"Failed to add the role '{claim.Name}' to keycloak.");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: repose

@@ -425,12 +425,12 @@ private async Task<KModel.UserModel> GetUserAsync(PModel.UserModel user)
try
{
// Make a request to keycloak to find a matching user.
var response = await _keycloakManagementClient.HandleRequestAsync<ResponseWrapperModel<IEnumerable<KModel.UserModel>>>(HttpMethod.Get, $"{_keycloakManagementClient.GetEnvUri()}/idir/users?guid={user.GuidIdentifierValue.ToString().Replace("-", string.Empty)}");
if (response.Data.Count() > 1)
var users = await _keycloakService.GetUsersAsync(user.GuidIdentifierValue);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this all looks good, using the repository should ensure consistency across the two projects.

@devinleighsmith
Copy link
Collaborator

@FuriousLlama this doesn't compile either, am I doing something wrong?

@devinleighsmith
Copy link
Collaborator

thanks for this!

Copy link
Contributor

github-actions bot commented Dec 1, 2023

✅ No secrets were detected in the code.

1 similar comment
Copy link
Contributor

github-actions bot commented Dec 1, 2023

✅ No secrets were detected in the code.

@FuriousLlama FuriousLlama merged commit 26c199e into bcgov:dev Dec 1, 2023
7 checks passed
FuriousLlama added a commit that referenced this pull request Dec 7, 2023
* Added check status logic when updating acq and related entities | psp-7006 (#3602)

* Added status checking to details, take, compensation and other acq file pages

* Updated backend and updated tests

* Fixed lint

* Refactored solver to be simpler

* Added tests

* Pr comments

* Added the sys-admin to edit acquisition fields

* CI: Bump version to v4.0.0-67.24

* Updated placeholder display (#3620)

* CI: Bump version to v4.0.0-67.25

* dialog correction. (#3629)

Co-authored-by: Smith <Devin.Smith@quartech.com>

* CI: Bump version to v4.0.0-67.26

* Keycloak Refactor (#3624)

* Refactored keycloak sync to use the keycloak repository used by the API. ALso removed tools.Core and removed redundant models

* pr fixes

* CI: Bump version to v4.0.0-67.27

* System error modal | psp-7304 (#3628)

* Updated Generic modal to use a variant

* Improved System error modal

* Lit fixes

* Info fixes

* CI: Bump version to v4.0.0-67.28

* psp-7346 correct bracket usage, ensure logic limited to file close only. (#3622)

* psp-7346 correct bracket usage, ensure logic limited to file close only.

* comment from code review.

* test correction.

---------

Co-authored-by: Smith <Devin.Smith@quartech.com>

* CI: Bump version to v4.0.0-67.29

* requested source marked as nullable for validation. (#3630)

Co-authored-by: Smith <Devin.Smith@quartech.com>

* CI: Bump version to v4.0.0-67.30

* allow showing the edit screen for management activity while the popout is open. (#3632)

Co-authored-by: Smith <Devin.Smith@quartech.com>

* CI: Bump version to v4.0.0-67.31

* Pims api to Frontend ts generator and generated files (#3618)

* Refactored concept models. Created a new library and cleaned dependencies between projects. Cleaned names of reused concepts and standarized concept namespace. Cleaned extension and help files

* Fixed lints

* Initial generator work

* Cleaned up files and improved translation

* Updated namespaces and path for the api models

* Updated generator and cleaned up code

* Added make command to generate ts api files and lint them.

* First generation of the pims api.

* Cleaned up generator and handled generic types. Improved header docks.

* Fixed solution

* Updated models for keycloak sync and fixed lint warnings

* Fixed registering mappers

* CI: Bump version to v4.0.0-67.32

* Bump DEV version - IS68 (#3636)

* CI: Bump version to v4.0.0-68.1

* Manual merges and re-generated snaps

* moved disposition models to the new api-models project

* re-generated api models

* Changed disposition property to property model type

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: devinleighsmith <41091511+devinleighsmith@users.noreply.github.com>
Co-authored-by: Smith <Devin.Smith@quartech.com>
Co-authored-by: Alejandro Sanchez <emailforasr@gmail.com>
@FuriousLlama FuriousLlama deleted the tech_debt/keycloak-cleanup branch December 15, 2023 20:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tech-debt Removing technical debt
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants