mirror of
https://github.com/pocket-id/pocket-id.git
synced 2025-12-09 14:53:00 +03:00
🚀 Feature: Ability to have custom claims be non-string objects #359
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 @gray-morley on GitHub.
Feature description
I would like the ability to define a custom claim as either String, List, or JSON.
Pitch
I have an application that expects either a list or a json object from the custom claims. Currently pocket id is causing a failure because it converts what we type in the UI to a string. Thus when the application tries to read the claim, it throws a parsing error.
Specifically, my application in use is Audiobookshelf with custom login claims.
Thanks
@stonith404 commented on GitHub:
Alright, thanks. I'll look into it.
@stonith404 commented on GitHub:
Can you share for which feature Audiobookshelf needs an object of a custom claim?
@gray-morley commented on GitHub:
Sure,
Here’s a screenshot of the claim that expects a json object:
This results in the following error:
2025-02-05 03:14:19.019
ERROR
[Auth] openid callback error: Unexpected permission property: 0 Error: Unexpected permission property: 0 at /server/models/User.js:845:15 at Array.forEach () at User.updatePermissionsFromExternalJSON (/server/models/User.js:842:33) at Auth.updateUserPermissions (/server/Auth.js:333:20) at OpenIDConnectStrategy._verify (/server/Auth.js:157:24) at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
Claim response looks like the following (set up in pocket id):
Using a group claim:
Claim name: abspermissions
Claim value: { "canDownload": true, "canUpload": false, "canDelete": false, "canUpdate": false, "canAccessExplicitContent": true, "canAccessAllLibraries": true, "canAccessAllTags": false, "canCreateEReader": false, "tagsAreDenylist": true, "allowedTags": [ "Test" ] }
In Audiobookshelf logs, it receives:
[Auth] openid callback userinfo= { "abspermissions": "{ "canDownload": true, "canUpload": false, "canDelete": false, "canUpdate": false, "canAccessExplicitContent": true, "canAccessAllLibraries": true, "canAccessAllTags": false, "canCreateEReader": false, "tagsAreDenylist": true, "allowedTags": [ "Test" ] }", "email": "XXXXXX", "email_verified": true, "family_name": "XXXXXX", "given_name": "XXXXX", "name": "XXXXXXXX", "preferred_username": "XXXXXXX", "sub": "XXXXXXXX" }
As you can see, the abspermissions value is wrapped in quotes
@stonith404 commented on GitHub:
Added in
v0.29.0.@gray-morley commented on GitHub:
Thanks