OIDC 客户端配置¶
要将应用接入 FlexGalaxy 身份体系,请在 DotID 中将其注册为 OIDC 客户端。DotID 颁发 OAuth 2.0 / OpenID Connect token,应用据此换取已认证会话,服务端则可对照签发 realm 的 JWKS 端点校验这些 token。
本页讲解注册流程、客户端类型,以及 DotID 强制执行的约定。
将应用注册为 OIDC 客户端¶
根据你的身份,注册客户端有两种方式。
自助服务(developer API)¶
外部开发者通过 developer self-service API 注册应用:
POST /developer/v1/services
提交声明你的 OIDC 客户端的服务注册清单(见外部开发者 API 示例)。成功创建会返回 201 Created。
Default: confidential. For native apps, mobile apps, SPAs, and CLIs, request a public client explicitly — the recommended shape for anything that runs on a user's device or in a browser. Set:
{ "public_client": true, "pkce": "S256" }
DotID 预配公共客户端(token_endpoint_auth_method=none)且不返回 client_secret — 公共客户端只通过证明拥有 PKCE code_verifier 来认证。公共客户端还会自动盖上两个协议映射器:
一个 audience 映射器(
aud=flexgalaxy-api),因此发出的访问令牌会被 FlexGalaxy.AI API 表面接受,并且一个
account_id映射器,因此可从令牌解析已登录用户的租户(见租户绑定声明)。
授予的作用域为 openid profile email。
对于服务器端机密客户端(会持有密钥),见下方机密客户端。如果你请求机密客户端但声明了原生(自定义 scheme)或回环重定向 URI,请求会以 400 被拒绝 — DotID 不会静默降级为携带密钥的客户端。请改用公共客户端处理这些重定向。
之后你可以检索或轮换凭据:
GET /developer/v1/services/{serviceId}/credentials
POST /developer/v1/services/{serviceId}/credentials/rotate
控制台(first-party / admin)¶
平台运维通过管理员控制台注册自家客户端:
Sign in to https://admin-console.flexgalaxy.ai/stargate with platform admin credentials.
进入 Applications 区域,选择 Register OIDC client。
填写以下字段:
Client ID —— 简短稳定的标识符(lower-kebab-case)。它将作为 OAuth 请求中
client_id参数的取值。Display name —— 用户在授权同意页看到的名称。
Realm —— 客户端所归属的 realm(参见下文 Realm 与应注册到哪个 realm)。
Client type —— confidential(机密)或 public(公开)。
Redirect URIs —— 客户端可接收授权码的 URI(精确匹配)。
Allowed scopes —— 通常为
openid profile email,再加上你的服务所需的任何自定义 scope。
保存后,DotID 会返回 client ID 以及(机密客户端的)client secret。请将 secret 存入你服务的密钥管理器 —— 它仅显示一次。
账户管理员通过其账户管理控制台注册账户范围的客户端,控制台会转发到同一后端,并预选好账户的 realm。
客户端类型¶
DotID 支持两种标准 OAuth 2.0 客户端类型。对于任何运行在用户设备或浏览器中的应用,优先使用公共客户端 + PKCE。
公开客户端¶
公共客户端无法保守密钥(浏览器单页应用、移动应用、原生应用、命令行工具)。它只通过证明拥有原始 PKCE code verifier 来认证 — DotID 不返回 client_secret。使用以下方式请求:
public_client: truepkce: S256
DotID 会拒绝来自未包含 PKCE verifier 的公共客户端的 authorization-code 交换。通过开发者 API 注册的公共客户端会自动盖上 aud(flexgalaxy-api)和 account_id 协议映射器,并被授予 openid profile email。
机密客户端¶
机密客户端运行在服务端,能够保管 secret。它使用 client_secret(或更严格场景下的私钥 JWT)向 token 端点认证。机密客户端适用于:
在服务端兑换授权码的后端服务。
使用 client credentials grant 的服务间调用。
客户端进程对最终用户不可见的任何流程。
client_secret 只在创建时返回一次 — 立即将其存入你的服务密钥管理器。
机密客户端不得声明原生(自定义 scheme)或回环重定向 URI。 这类请求会以 400 拒绝,而不是降级为携带密钥的客户端 — 请改为在公共客户端上注册这些重定向。
服务器端应用的推荐基线: 机密客户端 + Authorization Code 授权 + 带 S256 的 PKCE。客户端密钥与 PKCE 的组合可同时防御客户端冒充和授权码截获攻击。
Server-side workforce broker¶
An Organization may opt a confidential backend/BFF into the password grant when it must authenticate its own Identity Center users without a hosted browser redirect:
{
"public_client": false,
"token_endpoint_auth_method": "client_secret_basic",
"direct_access_grants": true
}
The client is projected into the platform realm, scoped to the registering
account's Organization, with an independent secret per Organization. Credential
metadata and rotation resolve only through that Organization, so the broker
cannot obtain another Organization's client secret. Public clients requesting
direct_access_grants=true are rejected. Successful and failed direct-grant
logins are recorded by Keycloak realm events with the client and user context.
This flow makes the broker handle the user's password and cannot complete browser-only required actions. Prefer Authorization Code + PKCE whenever a redirect is acceptable; enable this exception only for a server process that can protect both the client secret and submitted credentials.
Realm 与应注册到哪个 realm¶
DotID issues tokens from named realms. Which realm hosts your client determines which users can sign in to it and which APIs trust the tokens it issues.
平台级客户端 —— 注册到
flexgalaxyrealm。任何 FlexGalaxy.AI 用户(跨账户)均可登录此类客户端。Account service clients — use the Account boundary for non-human service identities. They are not interactive console clients; human console login uses the platform realm.
Workforce / Identity Center clients — register against the
flexgalaxyrealm. The legacy per-org (idc-*) realms were retired: workforce sign-in and permission-set assumption ride the platform realm plus the account/org claims on the token.Platform-administration clients — register against the
fgai-adminsrealm.
关于服务端应接受哪些 token,请参见 API 认证与 JWT 校验。
重定向 URI¶
DotID enforces exact-match redirect URIs. A registered URI of https://app.example.com/oauth2/callback does not match https://app.example.com/oauth2/callback/ (note the trailing slash) or https://app.example.com/oauth2/callback?foo=bar (extra query). Register every URI variant your application actually uses.
重定向信任按 URI 类型分层:
重定向类型 |
示例 |
信任 |
|---|---|---|
原生自定义 scheme |
|
仅公共客户端。自动受信任。 |
回环 |
|
仅公共客户端。自动受信任(任意端口,精确路径)。 |
生产 |
|
对于公共客户端,仅当 host 通过 |
对于带生产 https:// 重定向的公共客户端,请在清单的 verified_domains 中包含重定向 host(App Links / Universal Links 域名证明):
{
"public_client": true,
"pkce": "S256",
"redirect_uris": ["https://app.example.com/oauth2/callback"],
"verified_domains": ["app.example.com"]
}
host 不在 verified_domains 中的 https 重定向会被拒绝 — 这会证明在 DotID 将授权码发送到那里之前,应用控制该域名。
规则:
HTTPS is required for all production redirect URIs. Loopback
http://is permitted for native/CLI flows; other non-loopbackhttp://is rejected.重定向 URI 中不允许使用通配符。
重定向 URI 中不允许片段(
#…)。约定俗成的回调路径是
/oauth2/callback。如无充分理由请遵循该约定。
可申请的 scope¶
Scope |
效果 |
|---|---|
|
OIDC 必备 scope,颁发 ID token。 |
|
在 ID token 中加入 |
|
加入 |
|
加入 |
|
颁发 refresh token。长时间运行的后台进程必备。 |
平台运维可在每个 realm 中定义自定义 scope(如 dotid:audit:read)。请只申请你服务确实需要的 scope —— 过度宽泛的 scope 会在授权同意页被高亮提示,从而削弱用户信任。
关于如何校验这些 scope 产出的 token,请参见 API 认证与 JWT 校验。