Identity & Access Management (RBAC/OIDC)
Relevant source files
The following files were used as context for generating this wiki page:
Identity & Access Management (IAM) in Speakeasy controls how users authenticate to the platform and how permissions are enforced across services. The system supports OpenID Connect (OIDC) and OAuth 2.1 for identity federation and uses a granular Role-Based Access Control (RBAC) engine for authorization. Sources: CONTRIBUTING.md, REVIEW.md:66-72
Authentication Architecture
The authentication system manages user identities through integration with external Identity Providers (IDPs) such as WorkOS or a local emulator for development. Authentication results in an authctx which includes the ActiveOrganisationID. Sources: REVIEW.md:66-72, CONTRIBUTING.md:46-55
Local Identity Provider (dev-idp)
For local development, Speakeasy uses a lightweight Go server called dev-idp. It replaces external identity services and allows non-interactive login.
- OAuth 2.1 Surface: Provides an authorization server supporting PKCE and Dynamic Client Registration.
- Backends: Supports
local(git committer identity) andworkos(proxied WorkOS API calls). - WorkOS Emulator: Emulates Roles, Permissions, Team management, and Invitations.
Sources: CONTRIBUTING.md:46-118
Authentication Flow
The following sequence diagram illustrates the non-interactive login flow used in the development environment.
The login process spans both OAuth 2.1 and WorkOS REST surfaces, sharing a single SQLite database in the development environment. Sources: CONTRIBUTING.md:88-118
Role-Based Access Control (RBAC)
Authorization is enforced at the service layer using an RBAC engine. Every mutating handler must verify permissions before interacting with the database. Sources: REVIEW.md:66-72
Enforcement Mechanisms
The project uses specific patterns to ensure consistent permission checks:
- Require: Used in mutating handlers to enforce a specific scope (e.g.,
s.authz.Require(ctx, authz.Check{...})). - RequireAny: Used when a handler satisfies multiple equivalent scopes.
- Filter: Used for list endpoints to return only the items the requester is authorized to see.
- RequireScope (UI): A React component used in the dashboard to gate rendering of pages, sections, or components.
- useRBAC (UI): A React hook for imperative scope checks in frontend logic.
Sources: REVIEW.md:66-72, REVIEW.md:164-168
Permissions Table
| Scope Type | Application | Enforcement Point |
|---|---|---|
| Project Scoped | Access restricted to resources within a project_id. | SQLc Queries & authz |
| Organization Scoped | Access restricted to resources within an ActiveOrganisationID. | authctx & authz |
| Mutating Handlers | Creation, Updates, Deletions. | authz.Require |
| List Handlers | Resource enumeration. | authz.Filter |
Sources: REVIEW.md:66-72, REVIEW.md:102-108
Remote Identity Management
Remote Identity Providers (RIPs) represent configurations for signing into upstream services or MCP servers. This system abstracts complex OIDC/OAuth concepts into a simplified "Upstream Identity" model. Sources: client/dashboard/src/lib/remote-identity/README.md
Identity Modes
A server's identity configuration can exist in one of three modes:
- User Identity: Users sign in individually using a bound Remote Identity Provider.
- Shared Credential (Agent): Uses a static credential (e.g., API key) or a service account (OAuth client credentials).
- Manual: No managed identity; authentication is handled outside the Speakeasy proxy.
Sources: client/dashboard/src/lib/remote-identity/README.md:27-40
Remote Identity Data Model
The following diagram describes the relationship between internal records and the unified Remote Identity Provider concept.
Administrators experience the issuer and client as a single configuration, even though they are stored as separate records. Sources: client/dashboard/src/lib/remote-identity/README.md:14-25
OAuth Error Handling
Speakeasy provides specific user-facing error mapping for OAuth failures to assist in troubleshooting identity connections. Sources: server/internal/oauthui/authorization_error.html
| Error Kind | Description | Suggested Action |
|---|---|---|
organization-blocked | Org policy prevents the connection. | Contact organization administrator. |
invalid-client | Client verification or return address failed. | Check client support/configuration. |
incompatible | Unsupported sign-in method. | Update the MCP client. |
expired | Connection link is no longer valid. | Start connection again from client. |
session-changed | Sign-in session mismatch in browser. | Sign in again and retry. |
unavailable | Server-side internal error. | Retry in a few minutes. |
Sources: server/internal/oauthui/authorization_error.html:33-85
Audit Logging and Identity Context
Every mutation on project or organization-scoped resources must produce an audit entry. These entries are tied to the actor's identity found in the authctx.
- Atomicity: Audit writes must occur within the same database transaction as the mutation.
- Soft Deletes: Per-row audit entries are required even for cascading soft-deletes.
- Fail-Closed: Audit log failures are treated as
oops.CodeUnexpected, failing the entire request.
Sources: REVIEW.md:74-80
The IAM system ensures that all actions, from local development in dev-idp to production enterprise SSO integrations, remain observable, auditable, and strictly controlled via RBAC scopes. Sources: README.md, REVIEW.md