🚀 Feature: Allow custom claims #482

Closed
opened 2025-10-07 00:16:28 +03:00 by OVERLORD · 9 comments
Owner

Originally created by @tiehfood on GitHub.

Feature description

Would be great if I could add custom claims to the token and set the content in the user settings page.

Pitch

Some applications scrape additional information from claims. That could be a customer number, a group number a specific username field or any other information.
Implementation could be very simple. On the user page a button to add a button to create a new textfield. On creation give that field a name that corresponds to the claim name. Value could then be set per user.

Originally created by @tiehfood on GitHub. ### Feature description Would be great if I could add custom claims to the token and set the content in the user settings page. ### Pitch Some applications scrape additional information from claims. That could be a customer number, a group number a specific username field or any other information. Implementation could be very simple. On the user page a button to add a button to create a new textfield. On creation give that field a name that corresponds to the claim name. Value could then be set per user.
OVERLORD added the feature label 2025-10-07 00:16:28 +03:00
Author
Owner

@donkevlar commented on GitHub:

I've just finished the first version. Would you mind to test the stonith404/pocket-id:development image and give me some feedback about what you would change?

Hey, I just downloaded your dev image. This is super cool, testing it out now with a few of my apps. Ill report back if I run into any issues. Great work!

@donkevlar commented on GitHub: > I've just finished the first version. Would you mind to test the `stonith404/pocket-id:development` image and give me some feedback about what you would change? Hey, I just downloaded your dev image. This is super cool, testing it out now with a few of my apps. Ill report back if I run into any issues. Great work!
Author
Owner

@stonith404 commented on GitHub:

I wanted to provide a quick update: I’ve completed the initial version of this feature, but I’m not entirely satisfied with the current solution. It may take a bit more time to refine it, but rest assured, I haven’t forgotten about this request.

@stonith404 commented on GitHub: I wanted to provide a quick update: I’ve completed the initial version of this feature, but I’m not entirely satisfied with the current solution. It may take a bit more time to refine it, but rest assured, I haven’t forgotten about this request.
Author
Owner

@stonith404 commented on GitHub:

I'm working on support for user groups. Do you think it would make sense to also allow to set custom claims for user groups or is this only necessary for users?

@stonith404 commented on GitHub: I'm working on support for user groups. Do you think it would make sense to also allow to set custom claims for user groups or is this only necessary for users?
Author
Owner

@tiehfood commented on GitHub:

For sure that would make sense. Don't know how much effort that is, for my purpose you could keep it very simple :)

Great work

@tiehfood commented on GitHub: For sure that would make sense. Don't know how much effort that is, for my purpose you could keep it very simple :) Great work
Author
Owner

@stonith404 commented on GitHub:

I've just finished the first version. Would you mind to test the stonith404/pocket-id:development image and give me some feedback about what you would change?

@stonith404 commented on GitHub: I've just finished the first version. Would you mind to test the `stonith404/pocket-id:development` image and give me some feedback about what you would change?
Author
Owner

@stonith404 commented on GitHub:

@donkevlar Thanks, I've added custom claims to user groups.

@stonith404 commented on GitHub: @donkevlar Thanks, I've added custom claims to user groups.
Author
Owner

@stonith404 commented on GitHub:

This has been added in v0.12.0.

⚠️ For all that have used the development image make sure to run these commands before upgrading!

cd path-to-pocket-id

docker compose exec pocket-id apk add sqlite
docker compose exec pocket-id sqlite3 backend/data/pocket-id.db "ALTER TABLE app_config_variables DROP COLUMN default_value;" # Doesn't matter if it fails
docker compose exec pocket-id sqlite3 backend/data/pocket-id.db "DROP TABLE IF EXISTS custom_claims;"
docker compose exec pocket-id sqlite3 backend/data/pocket-id.db "UPDATE schema_migrations SET version = '20241023072742', dirty=0;"

nano docker-compose.yml # Change the tag to latest

docker compose pull && docker compose up -d
@stonith404 commented on GitHub: This has been added in `v0.12.0`. ⚠️ For all that have used the development image make sure to run these commands before upgrading! ```bash cd path-to-pocket-id docker compose exec pocket-id apk add sqlite docker compose exec pocket-id sqlite3 backend/data/pocket-id.db "ALTER TABLE app_config_variables DROP COLUMN default_value;" # Doesn't matter if it fails docker compose exec pocket-id sqlite3 backend/data/pocket-id.db "DROP TABLE IF EXISTS custom_claims;" docker compose exec pocket-id sqlite3 backend/data/pocket-id.db "UPDATE schema_migrations SET version = '20241023072742', dirty=0;" nano docker-compose.yml # Change the tag to latest docker compose pull && docker compose up -d ```
Author
Owner

@stonith404 commented on GitHub:

@donkevlar Thanks for the feedback. Also let me know if you find something not good in terms of user experience because I've never used custom claims before.

@stonith404 commented on GitHub: @donkevlar Thanks for the feedback. Also let me know if you find something not good in terms of user experience because I've never used custom claims before.
Author
Owner

@donkevlar commented on GitHub:

So overall works well, my only feedback (which might not be valid because I don't really know much about openID) is that it would be nice to have the groups have some sort of claims available to inherit as users. For example if I add a claim that might be specific to a custom application such as {type: userRole, value: admin}, to do this every time versus just adding them to a group makes things much easier. Again, Im not an OID expert, so not sure if thats done through other means. The current implementation works well on a single user basis though, and I did not have issues parsing a response to the profile scope on my test apps.

@donkevlar commented on GitHub: So overall works well, my only feedback (which might not be valid because I don't really know much about openID) is that it would be nice to have the groups have some sort of claims available to inherit as users. For example if I add a claim that might be specific to a custom application such as {type: userRole, value: admin}, to do this every time versus just adding them to a group makes things much easier. Again, Im not an OID expert, so not sure if thats done through other means. The current implementation works well on a single user basis though, and I did not have issues parsing a response to the profile scope on my test apps.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/pocket-id#482