configure-dynamic-claims
Configure Dynamic Claims in ABP
When a user authenticates, the claims baked into the access token or auth cookie stay fixed until they re-authenticate. For claims that must take effect immediately after they change (e.g. a role revoked from a user), ABP's dynamic claims feature overrides the token/cookie claim values with the latest values on each request. The default DynamicClaims set covers roles, profile claims (user name, name/surname, email, phone), and any custom claims explicitly added to DynamicClaims — not permission claims. Permission changes are handled by the permission system, not lumped into dynamic claims.
Enabled by default in startup templates from v8.0+. If you created your solution on v8.0 or later, it already works and you don't need to configure anything below. Follow these steps only when upgrading from an older version or building a custom host.
When to Use
- Claims (roles, profile claims, custom claims added to
DynamicClaims) must refresh mid-session without forcing a re-login. - Upgrading a solution created before v8.0, or building a custom host that authenticates.
- Wiring dynamic claims across a tiered structure (separate UI app + auth server) or microservice / resource-server apps.
- Adding a custom
IAbpDynamicClaimsPrincipalContributor.
When Not to Use
- Configuring the auth server itself (token lifetimes, certificates, refresh tokens) — use the configure-openiddict-authentication skill instead.
- Defining or checking permissions — use the permissions-and-authorization skill.
- Access that depends on a specific entity instance — use the authorize-resources skill.
- Solutions created on v8.0+ where dynamic claims already work out of the box — no configuration needed.