#1773·pocket-id

Feature: Claim Mapping Policy

Author: ghoudmonCreated Sep 21, 2026Updated Sep 25, 2026
Labelsneeds more upvotes

Feature description

Add policy to customize claim mapping returned in tokens and userinfo. It allows to customize the claims by client/usage.

Some use cases required to have additional claims in AccesssToken, or to have email as preferred_username for some clients, or add specific client claims.

This feature responds to existing feature requests: #1389, #1361, #807, #781. And, it could be a base to respond to #564.

This feature request is an update of the PR https://github.com/pocket-id/pocket-id/pull/1409, with another approach:

  • mutualize customization between clients
  • allow define the scope of each mapping
  • allow to defined the presence of the claim for access toke, id token and user info
  • simplify the client edition form

Pitch

Claim mapping policies define a list of claim mapping.

A claim mapping defines:

  • the claim name,
  • the source of the value,
  • the scope(s): the claim is add if 1 scope match requested scopes
  • if add to access token
  • if add to id token
  • if add to user info

A client is assign to 0 or 1 policy. If a client has no policy, the default policy is used.

Reserved claims can't be customized (ex: iat jti, ...). The policy has at least 1 mapping for the claim "sub". For this claims, only the source value is customizable.

The value of a claim is determine by the source type (User field, Group, Custom Mapping, Static value) and the source value. Examples:

  • claim: given_name => source type: User Field => source value: FirstName
  • claim: groups => source type: User Field => source value: Groups
  • claim: myKey => source type: Custom Claim => source value: thecustomekey

A special claim allow to add all custom claims: claim: *, source type: Custom Claim => source value: *

The migration can be made without any breaking changes by adding a "standard" policy configured with the current mappings.

Proposed UI

List of policies

Image

Policy definition Image

Claim definition Image

Assign clients

Image