Skip to content

AuxData for filling Principal.roles? #1576

Answered by charithe
bbodensieck asked this question in Q&A
Discussion options

You must be logged in to vote

If I understand your question correctly, you want the Cerbos SDK to give you back the parsed JWT claims? I am afraid that's not possible because the JWT parsing happens at the server side. You'll have to parse the token yourself if you want to access the claims on the client side.

You can access the JWT claims directly from Cerbos policy rules so if you only have a handful of roles, you could create Cerbos derived roles that are activated based on the value of the realm_access claim and use those instead.

Because Cerbos expects every principal to have a role, just send a dummy value for the role in your request. The real roles are then derived from the JWT.

---
apiVersion: "api.cerbos.dev/v1

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@bbodensieck
Comment options

Answer selected by bbodensieck
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants