Skip to content

feat: add fine-grained authorization (FGA) support#36

Open
lakhansamani wants to merge 1 commit into
mainfrom
feat/fga-support
Open

feat: add fine-grained authorization (FGA) support#36
lakhansamani wants to merge 1 commit into
mainfrom
feat/fga-support

Conversation

@lakhansamani
Copy link
Copy Markdown
Contributor

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 to SessionQueryRequest, ValidateJWTTokenRequest, and ValidateSessionRequest. If any required permission is denied, the result is unauthorized.
  • getPermissions(headers) — new method wrapping the permissions query; returns the authenticated principal's granted resource:scope permissions.
  • Permission / PermissionInput interfaces added to types.ts.
  • Integration tests: missing-required_permissions marks token invalid, and getPermissions returns the user's permissions.
  • README: new "Fine-grained authorization (FGA)" usage section.

Verification

  • tsc --noEmit
  • eslint
  • npm run build (tsup) ✅ — getPermissions, Permission, PermissionInput, required_permissions confirmed in emitted index.d.ts
  • Integration tests (testcontainers) compile; they require Docker + a running FGA-enabled Authorizer to execute.

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant