8000 Allow setting default value for userprofile attribute by huyenvu2101 · Pull Request #39746 · keycloak/keycloak · GitHub
[go: up one dir, main page]

Skip to content

Allow setting default value for userprofile attribute - #39746

Merged
pedroigor merged 4 commits into
keycloak:mainfrom
huyenvu2101:userprofile/attr-default-value
Aug 6, 2025
Merged

pedroigor merged 4 commits into
keycloak:mainfrom
huyenvu2101:userprofile/attr-default-value

Conversation

@huyenvu2101
@huyenvu2101 huyenvu2101 commented May 15, 2025 •
Copy link
Copy Markdown
Contributor

Closes #36160

  • Add a default value setting for attributes to automatically assign a default value when no value is provided.
  • Ensured default values are validated against the defined validators configuration.
  • Prefilled default values in relevant interfaces such as the Admin Console, Registration Form, etc.

Note: Attributes with a default value will no longer be set to null, as the default value is automatically applied.

image

@ahus1
ahus1 commented May 15, 2025
Copy link
Copy Markdown
Member

@huyenvu2101 - thank you for the PR. Please add a sign-off to your commit like outlined in the CONTRIBUTING.md file.

@pedroigor - maybe your team can have a look at this PR?

@huyenvu2101
huyenvu2101 force-pushed the userprofile/attr-default-value branch from f953006 to fa058c4 Compare May 15, 2025 11:34
@alexnuttinck
Copy link
Copy Markdown

Just wanted to highlight that I believe this feature would be highly valuable, as it simplifies default user attribute management.
Thanks for this PR, @huyenvu2101, I was actually looking for something like this!
I hope this pull request can be reviewed soon.

@huyenvu2101
huyenvu2101 force-pushed the userprofile/attr-default-value branch from 5f8d9c2 to ea74433 Compare July 21, 2025 02:13
@huyenvu2101
Copy link
Copy Markdown
Contributor Author

@pedroigor I hope you can take a look at this PR soon, we're really looking forward

@bono-ste
Copy link
Copy Markdown

Hope this PR will be merged soon. I also get the same problem with the default value

@ahus1
ahus1 commented Jul 25, 2025
Copy link
Copy Markdown
Member

Maybe one of the @keycloak/core-iam team members can have a look a this PR.

@and-ratajski
and-ratajski commented Jul 28, 2025 •
Copy link
Copy Markdown

Just wanted to confirm that this feature is highly awaited 🤓

@sguilhen sguilhen left a comment
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks @huyenvu2101, It looks good to me. I have requested @pedroigor to take a look and trigger the CI

@sguilhen
sguilhen requested a review from pedroigor August 4, 2025 14:02
@pedroigor pedroigor left a comment •
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@huyenvu2101 I cannot think why one would want to set a default for, let's say, the username, the same for others. We should avoid setting a default value for root attributes (username, email, first and last names).

From a UX perspective, the Default value should probably be hidden for the root attributes.

@pedroigor
pedroigor force-pushed the userprofile/attr-default-value branch from 918bbd0 to 3d0ea5f Compare August 4, 2025 16:29
@pedroigor
Copy link
Copy Markdown
Contributor

@huyenvu2101 Added a commit to:

  • Fix the UI when updating the field with a default value set. Instead of setting the value property, set the defaultValue instead so that the user can update the field with a new value.
  • Changed DefaultAttributes to make sure the default value is set whenever normalizing values.

@pedroigor
pedroigor force-pushed the userprofile/attr-default-value branch from 3d0ea5f to 4c2730d Compare August 4, 2025 16:52
@huyenvu2101
Copy link
Copy Markdown
Contributor Author

We should avoid setting a default value for root attributes

It sounds good to me, thanks @pedroigor for updating

huyenvu2101 and others added 4 commits August 6, 2025 07:44
Closes keycloak#36160

Signed-off-by: huyenvu2101 <vhuyen2101@gmail.com>
Signed-off-by: Pedro Igor <pigor.craveiro@gmail.com>
Signed-off-by: Pedro Igor <pigor.craveiro@gmail.com>
Signed-off-by: Pedro Igor <pigor.craveiro@gmail.com>
@pedroigor
pedroigor force-pushed the userprofile/attr-default-value branch from 4c2730d to f088e41 Compare August 6, 2025 11:46
@pedroigor
pedroigor merged commit ac632d6 into keycloak:main Aug 6, 2025
@pedroigor
Copy link
Copy Markdown
Contributor

@huyenvu2101 Thanks for your time and help!

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.

Default values for User attributes.

7 participants

0