Skip to content

integrated signum fetching and using it as optional username #4517

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

Merged
merged 10 commits into from
Apr 10, 2025

Conversation

feyruzb
Copy link
Collaborator

@feyruzb feyruzb commented Apr 2, 2025

integrated fetching of signum from id_token so it can be used as username for Microsoft.
Can be configured in configuration file what will be username:
"username": "mail" or "username": "signum".

@feyruzb feyruzb requested a review from bruntib April 2, 2025 15:23
@feyruzb feyruzb self-assigned this Apr 2, 2025
@feyruzb feyruzb requested a review from vodorok as a code owner April 2, 2025 15:23
@feyruzb feyruzb force-pushed the feature/get-signum-as-username branch from 51cee0b to 4b45197 Compare April 2, 2025 15:54
Copy link
Member

@dkrupp dkrupp left a comment

Choose a reason for hiding this comment

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

Please add the documentation of this new field to this document
https://github.com/Ericsson/codechecker/blob/master/docs/web/authentication.md#oauth-authentication

Is the handling of groups intentionally added to this PR?
Can you please factor it out into another PR? (anyway the graph API implementation is already in the baseline code, so I am not sure we need it at all)

user_groups_url = oauth_config["user_groups_url"]
response = oauth2_session.get(user_groups_url).json()
group_response = oauth2_session.get(user_groups_url)
Copy link
Member

@dkrupp dkrupp Apr 7, 2025

Choose a reason for hiding this comment

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

I see that in this pull request you are also fetching group names from the id token, however the description of the pull request is only describing that this PR will contain signum/email configuration.

Can you please place this group fetching code in another PR?
BTW Don't we use the graph APi to fetch the groups?
It's here

user_groups_url = oauth_config["user_groups_url"]

So why we need to take the groups from the ID token at all?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I don't use id token for fetching groups, that is still using Microsoft graph API but groups handling as it was before wasn't secure enough and could fail without notifying us.
That is why this more secure way was introduced.
As per request, I will create a separate pr for upgrading group fetching.

if group_name:
groups.append(group_name)

if oauth_config["user_info_mapping"]["username"] == "signum":
Copy link
Member

Choose a reason for hiding this comment

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

This will crash, if the "user_info_mapping" field is missing.
I think if it is missing it should default to the email address.

ebagfey added 2 commits April 8, 2025 15:59
@feyruzb feyruzb force-pushed the feature/get-signum-as-username branch from 3402823 to ee3b12e Compare April 8, 2025 14:08
Copy link
Member

@dkrupp dkrupp left a comment

Choose a reason for hiding this comment

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

please simplify the user_info_mapping configuration

Supported Providers and Options:

`github`
* Key: `login`
Copy link
Member

Choose a reason for hiding this comment

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

Please only accept username/email as a configuration and give a codechecker error if the configured value is something else.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed

@feyruzb feyruzb force-pushed the feature/get-signum-as-username branch 2 times, most recently from 603aa17 to fca042d Compare April 9, 2025 11:40
@feyruzb feyruzb force-pushed the feature/get-signum-as-username branch from fca042d to 0dd2670 Compare April 9, 2025 11:42
Comment on lines 426 to 427
"user_emails_url": "https://api.github.com/user/emails",
"scope": "openid email profile",
Copy link
Member

Choose a reason for hiding this comment

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

I am getting this error at authentication
User info fetch failed: "jwks_url'

I guess it is missing from the config file

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

fixed

Copy link
Member

Choose a reason for hiding this comment

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

But why is it still missing from this authentication md .json example?

Comment on lines 426 to 427
"user_emails_url": "https://api.github.com/user/emails",
"scope": "openid email profile",
Copy link
Member

Choose a reason for hiding this comment

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

But why is it still missing from this authentication md .json example?

Copy link
Member

@dkrupp dkrupp left a comment

Choose a reason for hiding this comment

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

LGTM

@dkrupp dkrupp merged commit 9817539 into Ericsson:master Apr 10, 2025
7 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants