mirror of
https://github.com/pocket-id/pocket-id.git
synced 2026-02-25 03:15:02 +03:00
🚀 Feature: Claim field override or custom per service mapping templating #403
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Ulrar on GitHub (Aug 2, 2025).
Feature description
Some basic templating support in the Custom Claims section of the user, to override fields such as email with something like
$serviceName. There may be a better way of doing this, that's just the first thing that came to mind.Pitch
I realize this is a bit of a niche use case, but I use a different email address per service. Currently PocketID just sends whatever it has as the user's email to the apps in the claim, which mean all of these apps are using the PocketID specific email address of my user, instead of their own.
But I'm sure there's other use cases for templated custom mapping fields.
@ItalyPaleAle commented on GitHub (Aug 8, 2025):
Would #781 be a way for you to implement this?
@Ulrar commented on GitHub (Aug 8, 2025):
@ItalyPaleAle there's already a way to add custom fields from the UI, but as far as I know it only takes plain text. I suppose fetching these from http may work but then I'd have to make and maintain an api for that, it's not ideal
@ItalyPaleAle commented on GitHub (Aug 8, 2025):
Indeed, having to maintain an API is the price you pay.
The benefits are that it's a lot more flexible (you can interact with external DBs, for example), and it doesn't require implementing a new DSL, which would result in a lot of things asked for the future.
@h3nnes commented on GitHub (Dec 30, 2025):
Stumbled across this issue when I tried setting up Mailcow with Pocket-ID (via generic-OIDC). The email address configured in my Pocket-ID profile does not match the mail ccount address in mailcow, so I was looking for a way to override the email claim to the mail address of my Mailcow mail account.
With a bit of help through non-biological intelligence, I've created a PoC with claim remapping capability. There are three ways to override claims for an individual app:
The feature is located in the advanced configuration section inside an OIDC-client. Docker image available here for testing.
For my usecase to override the email claim, it works like a charm.
@Ulrar commented on GitHub (Dec 30, 2025):
That looks interesting, are you going to open a PR for it ?
@h3nnes commented on GitHub (Dec 30, 2025):
@Ulrar I'm a bit hesitant about opening a PR. Since parts of the code are generated by Claude Code, I'm not sure if it meets the design, quality or security standards expected by the main developers (I'm not really a coder myself).
It should be more of a proof of concept, perhaps it will help to give an idea of what it could look like.
@h3nnes commented on GitHub (Jan 7, 2026):
@stonith404 Please check out this comment where I've compiled a PoC for claim remapping per OIDC client. I figured this could be useful for certain apps.
Is this something you would be interested in taking on and implementing into pocket-id?
The reason I didn't open a PR so far is because the PoC was half crafted using AI and I feel like it would be better to take a look at it here first before wasting your time reviewing a PR.
Thank you!