Skip to content
Security > Authentication

Authentication

3forge Enterprise has 2 separate plugin mechanisms for external identity, not one, and picking the wrong one for a given provider is the most common way to get stuck. Both mechanisms are configured entirely through property files, restarting to pick up the change: there is no admin panel or REST endpoint for setting this up, so delegating authentication to a corporate directory or identity provider is a deployment step, not a runtime one. Authentication controls who a user is; for what an authenticated user can then see and do, see Security.

Features

  • Check credentials against a real directory: an LDAP plugin validates the username and password a client sends, the same way the shipped default does, so REST and WebSocket clients keep sending a plain username and password.
  • Redirect logins to a SAML or Okta identity provider: a browser signing into the Web is redirected to your identity provider and back, so nobody types a password 3forge Enterprise itself checks.
  • Map directory attributes onto 3forge Enterprise roles: an LDAP or SAML attribute can set a user's admin flag, dev flag, layout, or session limit automatically, so provisioning happens in the directory, not in 3forge Enterprise.
  • Accept tokens from your identity provider: REST, the MCP server, and the RPC WebSocket server can accept a signed access token from your identity provider in place of a password. It is off until you configure it; see Bearer tokens.
  • Secure by default: a fresh install has no external identity provider reachable until you configure one; the shipped default authenticates against a local file.

Two plugin mechanisms, not one

ami.auth.plugin.class checks a username and password directly. It is what the shipped defaults (ACCESS_FILE, DISABLED) use, and LDAP uses it too: whichever surface a login comes through (the Web login page, or a REST API or RPC WebSocket client sending Authorization: Basic), the plugin sees the same username and password and returns the same outcome. The WebSocket streaming server is the exception: it uses its own ami.websocket.auth.plugin.class, which ships as DISABLED, so it checks no credentials until you set it. See WebSocket authentication.

sso.plugin.class is a different mechanism entirely: a browser is redirected to an external identity provider, which redirects it back once the person has signed in there. 3forge Enterprise never sees a password to check. This is what SAML, Okta, and generic OAuth use, and it works for the Web only: there's no way for a REST script or a WebSocket client to be "redirected" the way a browser is, so none of the 3 can authenticate a REST or WebSocket client. A browser that signed in through one of them can still reach REST with its Web session; see Web sessions.

Identity provider Mechanism Page
LDAP directory ami.auth.plugin.class (same as REST/WebSocket) LDAP
SAML identity provider sso.plugin.class (Web only) SAML
OAuth / OpenID Connect sso.plugin.class (Web only) OAuth
Okta sso.plugin.class (Web only), a separate plugin from generic OAuth Okta

Only one plugin can be active per mechanism: one ami.auth.plugin.class, and separately, one sso.plugin.class. You can't run 2 SSO providers side by side, and you can't have LDAP and an SSO provider both live at once for the same login attempt.

Whether the generic OAuth plugin is currently available as a built, requestable artifact is unconfirmed (tracked as A-03); see that page for detail.

Bearer tokens

REST, which includes the MCP server, and the RPC WebSocket server can accept an access token from your identity provider, sent as Authorization: Bearer <token>. This is not a plugin: setting ami.auth.bearer.issuer turns it on, and it works alongside whichever ami.auth.plugin.class is set. 3forge Enterprise checks tokens but does not issue them, so a client gets its token from the identity provider. Bearer tokens are off by default, and while they are off, a REST request that sends one is refused with 401.

1
2
3
4
5
6
# The identity provider's issuer, and where it publishes its signing keys
ami.auth.bearer.issuer=https://your-provider.example.com
ami.auth.bearer.jwks.url=https://your-provider.example.com/keys

# The audience tokens for this server carry, normally its MCP endpoint
ami.auth.bearer.audience=https://your-ami-host:33333/3forge_rest/mcp

A token is accepted when all of these hold:

  • It is a JWT signed with one of the accepted algorithms, by the key its kid header names among the keys published at ami.auth.bearer.jwks.url.
  • Its iss claim equals ami.auth.bearer.issuer, and its aud claim includes one of the values in ami.auth.bearer.audience.
  • It has an exp claim that has not passed, and its nbf and iat claims, when present, are not in the future.
  • Its typ header, when present, is one of ami.auth.bearer.token.types.
  • Its scope or scp claim grants every scope in ami.auth.bearer.required.scopes.

The user name is taken from the claim that ami.auth.bearer.username.claim names.

Property Default Purpose
ami.auth.bearer.issuer none The identity provider's issuer. Setting it turns bearer tokens on
ami.auth.bearer.audience none Comma-delimited audiences, normally this server's MCP endpoint URL. Required when the issuer is set, or startup fails
ami.auth.bearer.jwks.url none Where the identity provider publishes its signing keys. Required when the issuer is set, or startup fails. A URL that is not https:// logs a warning
ami.auth.bearer.username.claim sub The claim that names the user
ami.auth.bearer.algorithms RS256 Comma-delimited signing algorithms accepted: RS256, RS384, or RS512
ami.auth.bearer.clock.skew.seconds 60 Tolerance applied to exp, nbf, and iat
ami.auth.bearer.jwks.timeout.ms 5000 Timeout for fetching the signing keys
ami.auth.bearer.token.types at+jwt,JWT Accepted values of the typ header
ami.auth.bearer.token.type.required false Set to true to refuse a token with no typ header
ami.auth.bearer.required.scopes none Comma-delimited scopes every token must grant
ami.auth.bearer.resource the first audience This server's resource URL, advertised to clients. It must be an absolute URL, or startup fails
ami.auth.bearer.authorization.servers the issuer Comma-delimited authorization servers advertised to clients
ami.auth.bearer.scopes none Comma-delimited scopes advertised to clients

Mapping token claims to roles

Token claims map to roles with the same properties as the OAuth plugin, under ami.auth.bearer. instead of oauth.ami., for example ami.auth.bearer.roles.field and ami.auth.bearer.role.<role>.MCP_TOOLS.

  • With roles configured: a token whose claims name no enabled role is refused with 403, unless ami.auth.bearer.roles.required is false.
  • Without roles configured: every token the issuer signs for the audience is accepted, with only the ami.web.default.* grants, and startup logs a warning.
  • Admin and database rights: a token user has no AMIADMIN_PERMISSIONS or AMIDB_PERMISSIONS unless a role grants them. The deployment defaults for those rights do not apply to token users.

Finding the identity provider

While bearer tokens are on, the server publishes OAuth protected resource metadata (RFC 9728) wherever REST is served, at /.well-known/oauth-protected-resource followed by the path of ami.auth.bearer.resource, for example /.well-known/oauth-protected-resource/3forge_rest/mcp. Each Bearer challenge names that address as resource_metadata, so a client that supports it can find the identity provider from the server.

Web sessions

When REST is served on the Web port (ami.rest.uses.web.port, which ships as web), a request that carries a signed-in Web session's cookie runs as that session's user, with no credentials checked. This is how a browser that signed in through an SSO plugin reaches REST and the MCP server. With REST on its own port, the cookie is not used.

The RPC WebSocket server also accepts a token query parameter naming a signed-in Web session, as in /lsp?token=<token>. A token that the Web does not recognize is refused.

What a rejected login looks like

For an ami.auth.plugin.class login (the shipped defaults or LDAP) over REST, a bad username and a bad password look identical on the wire: both come back as the literal body text BAD_CREDENTIALS with HTTP 401, deliberately not telling a caller which part was wrong. A general error (the identity provider unreachable, for example) is INTERNAL_ERROR with HTTP 500. An sso.plugin.class login (SAML, Okta, OAuth) either succeeds or is rejected by the identity provider itself, before 3forge Enterprise is involved at all; there's no equivalent 2-outcome split for that path.

A bearer token that fails one of the checks in Bearer tokens gets HTTP 401 with the body Invalid bearer token: <reason>. A valid token that lacks a required scope or names no enabled role gets HTTP 403 with Bearer token not entitled: <reason>. Over the RPC WebSocket server, either refusal closes the connection.