bcgov / nr-forests-access-management

Authorization solution for BC natural resource sector
Apache License 2.0
8 stars 2 forks source link

Pass user_guid from frontend to backend #1285

Closed MCatherine1994 closed 7 months ago

MCatherine1994 commented 8 months ago

Describe the task We need user_guid to valid the user on backend, and store it. Frontend needs to store the user_guid in the form data, and pass it when making the api call to create user role assignment, create delegated admin and create application admin.

Acceptance Criteria

Additional context

ianliuwk1019 commented 7 months ago

May need to verify if we need to increase the existing "user_guid" column and "business_guid" column length to be larger enough. Currently they are: """ user_guid = Column(String(32)) business_guid = Column(String(32)) """

I guess this ticket only limit on scope of changing "schema" and only store it into database, not including use it for checking.

ianliuwk1019 commented 7 months ago

Might need to discuss which attribute from ID token to use for "user_id": "custom:idp_user_id" or "identities[0].user_id"

Sample from Wiki: https://github.com/bcgov/nr-forests-access-management/wiki/OIDC-Attribute-Mapping """ "custom:idp_user_id": "B5ECDB094DFB4149A6A8445A01A96BF0", "custom:idp_username": "COGUSTAF", "identities": [ { "userId": "b5ecdb094dfb4149a6a8445a01a96bf0@idir", "providerName": "IDIR", "providerType": "OIDC", "issuer": null, "primary": "true", "dateCreated": "1664399277929" } ], """

However, for BCSC, both fields seem to be the same value: """ "custom:idp_user_id": "NA5TCPGMIGUFVCSS6SAO3TIDBMAHXL3F", "identities": [ { "userId": "NA5TCPGMIGUFVCSS6SAO3TIDBMAHXL3F", "providerName": "TEST-BCSC", "providerType": "OIDC", "issuer": null, "primary": "true", "dateCreated": "1683668717501" } ], """

ianliuwk1019 commented 7 months ago

I checked our model does not have constraint for user_guid column and currently is already storing it from the attribute "custom:idp_user_id" so it resolved my confusion above, 32 characters should be fine and no uniqueness conflict.