forked from bcgov/common-hosted-form-service
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Assign to Me - not working (bcgov#1327)
* Update token parsing for current user idpUserId Signed-off-by: Jason Sherman <[email protected]> * set username to use value similar to the old values Signed-off-by: Jason Sherman <[email protected]> --------- Signed-off-by: Jason Sherman <[email protected]>
- Loading branch information
1 parent
c3b1d1b
commit e1cfc2e
Showing
5 changed files
with
180 additions
and
124 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
248 changes: 135 additions & 113 deletions
248
app/frontend/tests/unit/fixtures/identityProviders.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,119 +1,141 @@ | ||
[ | ||
{ | ||
"code": "idir", | ||
"display": "IDIR", | ||
"active": true, | ||
"idp": "idir", | ||
"createdBy": "migration-002", | ||
"createdAt": "2024-01-24T22:35:49.703Z", | ||
"updatedBy": null, | ||
"updatedAt": "2024-01-24T22:35:49.703Z", | ||
"primary": true, | ||
"login": true, | ||
"permissions": [ | ||
"views_form_stepper", | ||
"views_admin", | ||
"views_file_download", | ||
"views_form_emails", | ||
"views_form_export", | ||
"views_form_manage", | ||
"views_form_preview", | ||
"views_form_submissions", | ||
"views_form_teamS", | ||
"views_form_view", | ||
"views_user_submissions" | ||
], | ||
"roles": [ | ||
"owner", | ||
"team_manager", | ||
"form_designer", | ||
"submission_reviewer", | ||
"form_submitter" | ||
], | ||
"extra": {} | ||
{ | ||
"code": "idir", | ||
"display": "IDIR", | ||
"active": true, | ||
"idp": "idir", | ||
"createdBy": "migration-002", | ||
"createdAt": "2024-01-24T22:35:49.703Z", | ||
"updatedBy": null, | ||
"updatedAt": "2024-01-24T22:35:49.703Z", | ||
"primary": true, | ||
"login": true, | ||
"permissions": [ | ||
"views_form_stepper", | ||
"views_admin", | ||
"views_file_download", | ||
"views_form_emails", | ||
"views_form_export", | ||
"views_form_manage", | ||
"views_form_preview", | ||
"views_form_submissions", | ||
"views_form_teamS", | ||
"views_form_view", | ||
"views_user_submissions" | ||
], | ||
"roles": [ | ||
"owner", | ||
"team_manager", | ||
"form_designer", | ||
"submission_reviewer", | ||
"form_submitter" | ||
], | ||
"tokenmap": { | ||
"idpUserId": "idir_user_guid", | ||
"keycloakId": "idir_user_guid", | ||
"username": "idir_username", | ||
"firstName": "given_name", | ||
"lastName": "family_name", | ||
"fullName": "name", | ||
"email": "email", | ||
"idp": "identity_provider" | ||
}, | ||
{ | ||
"code": "bceid-basic", | ||
"display": "Basic BCeID", | ||
"active": true, | ||
"idp": "bceidbasic", | ||
"createdBy": "migration-022", | ||
"createdAt": "2024-01-24T22:35:49.703Z", | ||
"updatedBy": null, | ||
"updatedAt": "2024-01-24T22:35:49.703Z", | ||
"primary": false, | ||
"login": true, | ||
"permissions": [ | ||
"views_user_submissions" | ||
], | ||
"roles": [ | ||
"form_submitter" | ||
], | ||
"extra": { | ||
"formAccessSettings": "idim", | ||
"addTeamMemberSearch": { | ||
"text": { | ||
"message": "trans.manageSubmissionUsers.searchInputLength", | ||
"minLength": 6 | ||
}, | ||
"email": { | ||
"exact": true, | ||
"message": "trans.manageSubmissionUsers.exactBCEIDSearch" | ||
} | ||
} | ||
} | ||
"extra": {} | ||
}, | ||
{ | ||
"code": "bceid-basic", | ||
"display": "Basic BCeID", | ||
"active": true, | ||
"idp": "bceidbasic", | ||
"createdBy": "migration-022", | ||
"createdAt": "2024-01-24T22:35:49.703Z", | ||
"updatedBy": null, | ||
"updatedAt": "2024-01-24T22:35:49.703Z", | ||
"primary": false, | ||
"login": true, | ||
"permissions": ["views_user_submissions"], | ||
"roles": ["form_submitter"], | ||
"tokenmap": { | ||
"idpUserId": "bceid_user_guid", | ||
"keycloakId": "bceid_user_guid", | ||
"username": "bceid_username", | ||
"firstName": null, | ||
"lastName": null, | ||
"fullName": "name", | ||
"email": "email", | ||
"idp": "identity_provider" | ||
}, | ||
{ | ||
"code": "bceid-business", | ||
"display": "Business BCeID", | ||
"active": true, | ||
"idp": "bceidbusiness", | ||
"createdBy": "migration-022", | ||
"createdAt": "2024-01-24T22:35:49.703Z", | ||
"updatedBy": null, | ||
"updatedAt": "2024-01-24T22:35:49.703Z", | ||
"primary": false, | ||
"login": true, | ||
"permissions": [ | ||
"views_form_export", | ||
"views_form_manage", | ||
"views_form_submissions", | ||
"views_form_teamS", | ||
"views_form_view", | ||
"views_user_submissions" | ||
], | ||
"roles": [ | ||
"team_manager", | ||
"submission_reviewer", | ||
"form_submitter" | ||
], | ||
"extra": { | ||
"formAccessSettings": "idim", | ||
"addTeamMemberSearch": { | ||
"text": { | ||
"message": "trans.manageSubmissionUsers.searchInputLength", | ||
"minLength": 6 | ||
}, | ||
"email": { | ||
"exact": true, | ||
"message": "trans.manageSubmissionUsers.exactBCEIDSearch" | ||
} | ||
} | ||
"extra": { | ||
"formAccessSettings": "idim", | ||
"addTeamMemberSearch": { | ||
"text": { | ||
"message": "trans.manageSubmissionUsers.searchInputLength", | ||
"minLength": 6 | ||
}, | ||
"email": { | ||
"exact": true, | ||
"message": "trans.manageSubmissionUsers.exactBCEIDSearch" | ||
} | ||
} | ||
} | ||
}, | ||
{ | ||
"code": "bceid-business", | ||
"display": "Business BCeID", | ||
"active": true, | ||
"idp": "bceidbusiness", | ||
"createdBy": "migration-022", | ||
"createdAt": "2024-01-24T22:35:49.703Z", | ||
"updatedBy": null, | ||
"updatedAt": "2024-01-24T22:35:49.703Z", | ||
"primary": false, | ||
"login": true, | ||
"permissions": [ | ||
"views_form_export", | ||
"views_form_manage", | ||
"views_form_submissions", | ||
"views_form_teamS", | ||
"views_form_view", | ||
"views_user_submissions" | ||
], | ||
"roles": ["team_manager", "submission_reviewer", "form_submitter"], | ||
"tokenmap": { | ||
"idpUserId": "bceid_user_guid", | ||
"keycloakId": "bceid_user_guid", | ||
"username": "bceid_username", | ||
"firstName": null, | ||
"lastName": null, | ||
"fullName": "name", | ||
"email": "email", | ||
"idp": "identity_provider" | ||
}, | ||
{ | ||
"code": "public", | ||
"display": "Public", | ||
"active": true, | ||
"idp": "public", | ||
"createdBy": "migration-002", | ||
"createdAt": "2024-01-24T22:35:49.703Z", | ||
"updatedBy": null, | ||
"updatedAt": "2024-01-24T22:35:49.703Z", | ||
"primary": false, | ||
"login": false, | ||
"permissions": [], | ||
"roles": null, | ||
"extra": {} | ||
"extra": { | ||
"formAccessSettings": "idim", | ||
"addTeamMemberSearch": { | ||
"text": { | ||
"message": "trans.manageSubmissionUsers.searchInputLength", | ||
"minLength": 6 | ||
}, | ||
"email": { | ||
"exact": true, | ||
"message": "trans.manageSubmissionUsers.exactBCEIDSearch" | ||
} | ||
} | ||
} | ||
] | ||
}, | ||
{ | ||
"code": "public", | ||
"display": "Public", | ||
"active": true, | ||
"idp": "public", | ||
"createdBy": "migration-002", | ||
"createdAt": "2024-01-24T22:35:49.703Z", | ||
"updatedBy": null, | ||
"updatedAt": "2024-01-24T22:35:49.703Z", | ||
"primary": false, | ||
"login": false, | ||
"permissions": [], | ||
"roles": null, | ||
"extra": {} | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,7 +33,8 @@ describe('auth getters', () => { | |
name: 'John Doe', | ||
email: '[email protected]', | ||
identity_provider: 'idir', | ||
idp_userid: zeroGuid, | ||
idir_user_guid: zeroGuid, | ||
idir_username: 'JDOE', | ||
preferred_username: 'johndoe', | ||
realm_access: {}, | ||
client_roles: roles, | ||
|
@@ -185,12 +186,13 @@ describe('auth getters', () => { | |
it('creates an auth user when authenticated', () => { | ||
expect(store.user).toBeTruthy(); | ||
expect(store.user).toEqual({ | ||
username: 'johndoe', | ||
username: 'JDOE', | ||
firstName: 'John', | ||
lastName: 'Doe', | ||
fullName: 'John Doe', | ||
email: '[email protected]', | ||
idp: {code: 'idir', display: 'IDIR', hint: 'idir'}, | ||
idp: { code: 'idir', display: 'IDIR', hint: 'idir' }, | ||
idpUserId: zeroGuid, | ||
public: false, | ||
}); | ||
}); | ||
|
@@ -201,6 +203,7 @@ describe('auth getters', () => { | |
|
||
expect(store.user).toBeTruthy(); | ||
expect(store.user).toEqual({ | ||
idpUserId: '', | ||
username: '', | ||
firstName: '', | ||
lastName: '', | ||
|