Skip to content

Commit

Permalink
chore: fixing userid format (#510)
Browse files Browse the repository at this point in the history
  • Loading branch information
paulushcgcj authored Dec 2, 2024
1 parent d8c031d commit 1296912
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public Optional<UserInfo> getUserInfo() {
// User id {IDIR@USERNAME}
String cappedUsername = idpUsername.toUpperCase();
String cappedProvider = provider.toUpperCase();
String userId = String.format("%s@%s", cappedProvider, cappedUsername);
String userId = String.format("%s\\%s", cappedProvider, cappedUsername);

// Email will be empty, until next FAM release
String email = jwtPrincipal.getClaimAsString("email");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ void getUserInfoIdirTest() {
builder.claim("custom:idp_display_name", "from Baggings, Bilbo LWRS:EX");
builder.claim("custom:idp_username", "BAGGINGS");
builder.claim("custom:idp_name", "idir");
builder.claim("cognito:username", "IDIR@BAGGINGS");
builder.claim("cognito:username", "IDIR\\BAGGINGS");
builder.claim("client_roles", List.of("admin", "manager"));

when(authentication.getPrincipal()).thenReturn(builder.build());
Expand All @@ -57,7 +57,7 @@ void getUserInfoIdirTest() {
Assertions.assertTrue(userInfoOptional.isPresent());

UserInfo userInfo = userInfoOptional.get();
Assertions.assertEquals("IDIR@BAGGINGS", userInfo.id());
Assertions.assertEquals("IDIR\\BAGGINGS", userInfo.id());
Assertions.assertEquals("Bilbo", userInfo.firstName());
Assertions.assertEquals("Baggings", userInfo.lastName());
Assertions.assertEquals("[email protected]", userInfo.email());
Expand Down Expand Up @@ -85,15 +85,15 @@ void getUserInfoBusinessBceidTest() {
builder.claim("custom:idp_display_name", "Lord Sauron of Mordor");
builder.claim("custom:idp_username", "MORDOR-BCEID");
builder.claim("custom:idp_name", "bceidbusiness");
builder.claim("cognito:username", "BCEIDBUSINESS@MORDOR-BCEID");
builder.claim("cognito:username", "BCEIDBUSINESS\\MORDOR-BCEID");

when(authentication.getPrincipal()).thenReturn(builder.build());

Optional<UserInfo> userInfoOptional = userAuthenticationHelper.getUserInfo();
Assertions.assertTrue(userInfoOptional.isPresent());

UserInfo userInfo = userInfoOptional.get();
Assertions.assertEquals("BCEIDBUSINESS@MORDOR-BCEID", userInfo.id());
Assertions.assertEquals("BCEIDBUSINESS\\MORDOR-BCEID", userInfo.id());
Assertions.assertEquals("Lord", userInfo.firstName());
Assertions.assertEquals("Sauron of Mordor", userInfo.lastName());
Assertions.assertEquals("[email protected]", userInfo.email());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,26 +134,25 @@ INSERT INTO THE.STOCKING_EVENT_HISTORY
REVISION_COUNT
)
VALUES(111, 101, 101, 1, 'O', 'Results data conversion', 111, TO_DATE('2024-01-20 00:00:00', 'YYYY-MM-DD HH24:MI:SS'), 'Results data conversion', TO_DATE('2024-01-20 00:00:00', 'YYYY-MM-DD HH24:MI:SS'), 1);

INSERT INTO THE.RESULTS_AUDIT_EVENT
(
RESULTS_AUDIT_EVENT_ID,
OPENING_ID,
STANDARDS_REGIME_ID,
SILVICULTURE_PROJECT_ID,
RESULTS_AUDIT_ACTION_CODE,
ACTION_DATE,
DESCRIPTION,
USER_ID,
EMAIL_SENT_IND,
RESULTS_AUDIT_EVENT_ID,
OPENING_ID,
STANDARDS_REGIME_ID,
SILVICULTURE_PROJECT_ID,
RESULTS_AUDIT_ACTION_CODE,
ACTION_DATE,
DESCRIPTION,
USER_ID,
EMAIL_SENT_IND,
XML_SUBMISSION_ID,
OPENING_AMENDMENT_NUMBER,
ENTRY_USERID,
OPENING_AMENDMENT_NUMBER,
ENTRY_USERID,
ENTRY_TIMESTAMP
)
VALUES
(1, 101, NULL, NULL, 'SUB', TO_DATE('2024-01-20 00:00:00', 'YYYY-MM-DD HH24:MI:SS'), 'Forest Cover 0000000', NULL, 'Y', 101, 101, 'TEST\OTTOMATED', TO_DATE('2024-01-20 00:00:00', 'YYYY-MM-DD HH24:MI:SS')),
(2, 102, NULL, NULL, 'SUB', TO_DATE('2024-01-20 00:00:00', 'YYYY-MM-DD HH24:MI:SS'), 'Forest Cover 0000000', NULL, 'Y', 102, 102, 'IDIR@TEST', TO_DATE('2024-01-20 00:00:00', 'YYYY-MM-DD HH24:MI:SS'));
(1, 101, NULL, NULL, 'SUB', TIMESTAMP '2024-01-20 00:00:00.000000', 'Forest Cover 0000000', NULL, 'Y', 101, 101, 'TEST\OTTOMATED', TIMESTAMP '2024-01-20 00:00:00.000000'),
(2, 102, NULL, NULL, 'SUB', TIMESTAMP '2024-01-20 00:00:00.000000', 'Forest Cover 0000000', NULL, 'Y', 102, 102, 'IDIR\TEST', TIMESTAMP '2024-01-20 00:00:00.000000');

INSERT INTO THE.ACTIVITY_TREATMENT_UNIT
(
Expand Down

0 comments on commit 1296912

Please sign in to comment.