Skip to content

Commit

Permalink
✨(auth) fix empty name from ProConnect
Browse files Browse the repository at this point in the history
add proconnect scopes for names to be computed automatically
upon user creation
This commit fixes the way names are computed from ProConnect claims
  • Loading branch information
mjeammet committed Feb 10, 2025
1 parent 961bceb commit 4d3901b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ and this project adheres to

### Fixed

- ✨(auth) fix empty names from ProConnect #687
- 🚑️(teams) do not display add button when disallowed #676
- 🚑️(plugins) fix name from SIRET specific case #674
- 🐛(api) restrict mailbox sync to enabled domains
Expand Down
3 changes: 1 addition & 2 deletions src/backend/core/authentication/backends.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,12 @@ def get_or_create_user(self, access_token, id_token, payload):
)

# Get user's full name from OIDC fields defined in settings
full_name = self.compute_full_name(user_info)
email = user_info.get("email")

claims = {
"sub": sub,
"email": email,
"name": full_name,
"name": self.compute_full_name(user_info),
}
if settings.OIDC_ORGANIZATION_REGISTRATION_ID_FIELD:
claims[settings.OIDC_ORGANIZATION_REGISTRATION_ID_FIELD] = user_info.get(
Expand Down
3 changes: 2 additions & 1 deletion src/helm/env.d/dev/values.desk.yaml.gotmpl
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ backend:
name: backend
key: OIDC_RP_CLIENT_SECRET
OIDC_RP_SIGN_ALGO: RS256
OIDC_RP_SCOPES: "openid email siret"
OIDC_RP_SCOPES: "openid email siret given_name usual_name"
USER_OIDC_FIELDS_TO_NAME: "given_name,usual_name"
OIDC_REDIRECT_ALLOWED_HOSTS: https://desk.127.0.0.1.nip.io
OIDC_AUTH_REQUEST_EXTRA_PARAMS: "{'acr_values': 'eidas1'}"
ORGANIZATION_PLUGINS: "plugins.organizations.NameFromSiretOrganizationPlugin"
Expand Down

0 comments on commit 4d3901b

Please sign in to comment.