-
Notifications
You must be signed in to change notification settings - Fork 12
feat: add unique id to users to be able to match users with external user services #1307
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
Changes from all commits
24929cb
9323fda
691c4aa
34134e8
c6490c8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| DO | ||
| $$ | ||
| BEGIN | ||
| IF register_patch('AlterUsersUniqueId.sql', 'Gergely Nyiri', 'Adding column unique_id to users', '2026-01-12') THEN | ||
| BEGIN | ||
| ALTER TABLE users ADD COLUMN unique_id varchar(100) UNIQUE; | ||
| END; | ||
| END IF; | ||
| END; | ||
| $$ | ||
| LANGUAGE plpgsql; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| import 'reflect-metadata'; | ||
| import { env } from 'process'; | ||
| import 'reflect-metadata'; | ||
|
|
||
| import { logger } from '@user-office-software/duo-logger'; | ||
| import { OpenIdClient } from '@user-office-software/openid'; | ||
|
|
@@ -176,7 +176,8 @@ export class OAuthAuthorization extends UserAuthorization { | |
| '', | ||
| (userInfo.position as string) ?? '', | ||
| userInfo.email, | ||
| '' | ||
| '', | ||
| userInfo.unique_id as string | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think, we need to have a fallback. Facility like ESS, would n't have Could you handle this in safe way?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I tested it with and without mapping unique_id from the Auth Server and it works safely. |
||
| ); | ||
|
|
||
| const roleID = this.getUserRole(newUser); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gnyiri Hi Thanks for this PR. I have few fundamental questions and more curious about the answers.
unique_id?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am OK with the JSON approach that could store all auxiliary, locally needed fields in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With JSON will it be possible to enforce database constrains, l am okay with an approach we we may have a generic id that can be used as
oidc_subalso.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the clarification.
Just curious about the "join" you have mentioned. Is it some DB join that you are doing on outside UOS?
We are currently in the process of cleaning up the users table(PR) and its column to keep it optimised. Hence, any new column should be carefully discussed and evaluated.
I am trying to evaluate the alternative approaches, as I am only a bit concerned about the impact of the new column(unique_id), that could potentially slow down the table(Not on grand scale, but still significant) due to unique indexing.
As i understand, Since you are not going to use oidc_sub, is it possible for you to use the same column for your use case. If so, we can rename the column
oidc_subto something likeauth_identifierand use it according to facility's need. I know this would result in writing your own Authentication like STFC, but that should be fine, as you already now have your special use case. Let me know your thoughts about this.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mutambaraf Agreed. Json is not a fit-in solution here. Thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@yoganandaness : not a real join rather a matching. We have a DB that is a "fusion" of multiple DB-s (UOS, registration, experiments, .etc..). We use this DB for generating reports to the MGMT, e.g. reports showing proposals per affiliation and so on. This unique_id would be needed to be able to match UOS users with the registration DB where the real user data is stored.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In fact, our original idea was to misuse the oidc_sub column for storing our unique_id but not sure if we can force the auth service to encode the unique_id as oidc_sub in user info (and if so what is the side effect). What else we can do is to encode both unique_id and oidc_sub and change UOS code for ELI to store unique_id instead of oidc_sub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@yoganandaness: renaming oidc_sub to auth_identifier is a good idea. I think that we can move that way.