feat: add fine-grained authorization (FGA) support#36
Open
lakhansamani wants to merge 1 commit into
Open
Conversation
Add client-facing FGA capabilities mirroring the server's authorization API: - required_permissions (PermissionInput[], AND semantics) on SessionQueryRequest, ValidateJWTTokenRequest and ValidateSessionRequest - getPermissions(headers) wrapping the permissions query, returning the authenticated principal's granted resource:scope permissions - Permission / PermissionInput types - Integration tests for getPermissions and required-permissions validation - README usage section
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds client-facing Fine-Grained Authorization (FGA) support to the JS SDK, mirroring the authorization API shipped on the Authorizer server. FGA was planned but not yet present in the SDK.
The server's FGA model is Keycloak-style (resources / scopes / policies / permissions). This PR wraps the two surfaces relevant to a client SDK; admin
_authz_*CRUD is intentionally excluded to keep the SDK's client-only scope (it exposes no admin operations).Changes
required_permissions(PermissionInput[], AND semantics) added toSessionQueryRequest,ValidateJWTTokenRequest, andValidateSessionRequest. If any required permission is denied, the result is unauthorized.getPermissions(headers)— new method wrapping thepermissionsquery; returns the authenticated principal's grantedresource:scopepermissions.Permission/PermissionInputinterfaces added totypes.ts.required_permissionsmarks token invalid, andgetPermissionsreturns the user's permissions.Verification
tsc --noEmit✅eslint✅npm run build(tsup) ✅ —getPermissions,Permission,PermissionInput,required_permissionsconfirmed in emittedindex.d.ts