Skip to content

feat: admin API client and protocol selection (graphql/rest/grpc)#17

Merged
lakhansamani merged 6 commits into
mainfrom
feat/admin-apis
Jun 16, 2026
Merged

feat: admin API client and protocol selection (graphql/rest/grpc)#17
lakhansamani merged 6 commits into
mainfrom
feat/admin-apis

Conversation

@lakhansamani

Copy link
Copy Markdown
Contributor

What

  • Admin API client (AuthorizerAdminClient) covering the full AuthorizerAdminService surface: admin auth/session/meta, users, access (revoke/enable/invite), webhooks, email templates, audit logs, and FGA admin (model/tuples/list/expand/reset). Auth via x-authorizer-admin-secret.
  • Protocol selection on both the user and admin clients: graphql (default, backward compatible), rest, grpc. The same method runs over any supported transport.

Why

Server 2.3.0-rc.9 (#635) serves all auth ops over gRPC/REST with a flat response envelope identical to GraphQL, so the SDK can offer real protocol choice and a typed admin surface.

Notes

  • gRPC listens on a separate port (default :9091); set via WithGRPCEndpoint. Bearer/admin-secret are sent as outgoing metadata. Use --grpc-insecure server-side for plaintext.
  • REST decodes proto JSON (int64-as-string) via protojson.
  • Generated gRPC stubs vendored under internal/genpb (regenerated in the main authorizer repo).
  • Integration tests sweep every method across its supported protocols; adds a Test workflow and examples/manual smoke script.
  • Includes 3 trailing FGA-refinement commits (Origin/CSRF fix + ListPermissions schema align) not yet on main; the admin/protocol work depends on the Origin fix.

- split fga.go into check_permissions.go / list_permissions.go to
  match the one-file-per-API layout
- ListPermissions: relation/object_type now optional (empty request
  lists everything the caller holds); response adds permissions
  (object/relation detail) and truncated (1000-entry cap flag)
- widen FGA-unavailable skip detection so integration tests skip
  cleanly against pre-FGA server images
Authorizer >= v2.3.0 rejects state-changing requests without an
Origin/Referer header (CSRF guard), which 403'd every call from this
server-side client. Default Origin to the server's own origin (always
passes the guard's same-origin rule); callers can override it via
ExtraHeaders or per-call headers for ALLOWED_ORIGINS allowlists.

Also surface non-GraphQL failure responses (the guard's 403, proxy
error pages) as errors — previously they produced a nil result with a
nil error and panicked callers.

Verified live against quay.io/authorizer/authorizer:2.3.0-rc.2:
full suite passes (9 pass / 4 env skips); login, check_permissions and
list_permissions all 403'd before this fix.
Add AuthorizerAdminClient over the AuthorizerAdminService surface (users,
access, webhooks, email templates, audit, FGA admin) plus a Protocol
option (graphql default, rest, grpc) on the user and admin clients, so
the same calls run over GraphQL, REST, or gRPC.

- gRPC uses a separate endpoint (default :9091), configurable via
  WithGRPCEndpoint; auth/admin-secret flow as outgoing metadata.
- REST decodes proto JSON (int64-as-string) via protojson.
- Responses use the flat rc.9 envelope (PR #635), identical across
  transports.
- Vendor generated gRPC stubs under internal/genpb.
- Integration tests sweep every method across supported protocols;
  add Test CI and an examples/manual smoke script.
@lakhansamani lakhansamani merged commit 1f2e9f3 into main Jun 16, 2026
1 check failed
@lakhansamani lakhansamani deleted the feat/admin-apis branch June 16, 2026 14:02
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