Skip to content

Commit b18ebf3

Browse files
committed
wip: translations, docs section, changeset
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEkQ5nXM5CEyYnbaY58Spo
1 parent b460b13 commit b18ebf3

9 files changed

Lines changed: 157 additions & 0 deletions

File tree

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
'@objectstack/plugin-auth': minor
3+
'@objectstack/platform-objects': minor
4+
---
5+
6+
feat(plugin-auth,platform-objects): per-provider SSO sign-in options for IdP-initiated sign-in and just-in-time accounts, and `invite_only` now refuses an SSO sign-in by someone who was not invited
7+
8+
Clause-②: yes (widening)
9+
Metadata-protocol: none
10+
11+
**Behaviour change for existing deployments.** Under the `invite_only` audience posture, which is the default, an enterprise SSO sign-in (OIDC or SAML, through `@better-auth/sso`) by a person who has no account and no pending invitation is now refused. It redirects to the error page with `error=SELF_REGISTRATION_CLOSED`, and no user is created. Before, such a sign-in created the account. To keep the old behaviour for a provider, turn on its new `allowJit` option: **Setup → SSO Providers → Edit Sign-In Options**, or `POST /api/v1/auth/sso/update-provider` with `{ providerId, allowJit: true }`. Unchanged: a person who already has an account, a person with a pending invitation, the first human of an empty deployment, every sign-in under the `email_domain` or `open` posture, and the social and `oidcProviders` sign-ins.
12+
13+
- **Two options on each SSO provider, both off by default.** `sys_sso_provider` gains `allow_idp_initiated` and `allow_jit` (boolean, default false, history tracked). They are declared to `@better-auth/sso` as provider `additionalFields`, so its own `/sso/register` and `/sso/update-provider` accept them, a non-boolean is refused 400 `VALIDATION_ERROR`, and the people who can write a provider today are the only ones who can change them. Every change writes a `sys_audit_log` row and a field-level activity line with the old and the new value.
14+
- **IdP-initiated sign-in (SAML and OIDC).** Off, a SAML Response with no `InResponseTo` is refused `error=unsolicited_response`, and an OIDC callback with a `code` and no `state` is refused `error=state_not_found`, as before. On, the vendor's own IdP-initiated handling runs for that provider only. For SAML, the vendor's plugin-wide `saml.allowIdpInitiated` now answers the provider's column for each ACS request. For OIDC, the column is carried into the configuration the vendor reads, and an `allowIdpInitiated` member stored in that configuration is ignored and removed on the next write.
15+
- **Setup.** The SSO Providers list shows both options, and each row has an **Edit Sign-In Options** action.

‎content/docs/permissions/sso.mdx‎

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,64 @@ configure on the IdP side:
368368
369369
---
370370

371+
## Per-provider sign-in options
372+
373+
Each registered SSO provider, OIDC or SAML, carries two switches. Both are
374+
**off** by default.
375+
376+
| Option | Column on `sys_sso_provider` | When on |
377+
|---|---|---|
378+
| `allowIdpInitiated` | `allow_idp_initiated` | The provider may start a sign-in from the IdP's own portal, with no request from this platform. |
379+
| `allowJit` | `allow_jit` | Under the `invite_only` audience posture, the provider may create an account for a person who has none and holds no invitation. |
380+
381+
**Changing them.** Use **Setup → SSO Providers → Edit Sign-In Options** on a
382+
provider row. It posts to `POST /api/v1/auth/sso/update-provider` with
383+
`{ providerId, allowIdpInitiated, allowJit }`, and `POST /api/v1/auth/sso/register`
384+
takes the same two members. The people who can change a provider today are the
385+
only ones who can change these options. A value that is not a boolean is refused
386+
**400 `VALIDATION_ERROR`**, and nothing is written. Both fields keep a history,
387+
so every change writes a row to the audit ledger (`sys_audit_log`) and a
388+
field-level line to the record's activity feed, naming the old and the new value.
389+
390+
### IdP-initiated sign-in
391+
392+
With the option off, a sign-in the IdP starts on its own is refused, and nobody
393+
is signed in:
394+
395+
- **SAML.** A Response with no `InResponseTo` redirects to the error page with
396+
`error=unsolicited_response`.
397+
- **OIDC.** A callback that carries a `code` and no `state` redirects with
398+
`error=state_not_found`.
399+
400+
With it on, `@better-auth/sso` accepts that sign-in, and the platform adds no
401+
mechanism of its own. A SAML Response with no `InResponseTo` is validated like
402+
any other and signs the user in. An OIDC callback with no `state` restarts the
403+
flow at the IdP's authorization endpoint with a fresh `state`, and the sign-in
404+
completes from there. A sign-in this platform starts is unchanged either way.
405+
406+
The option belongs to one provider: turning it on for one SAML provider does not
407+
accept unsolicited Responses for another. For OIDC, the column is the only
408+
place it is set. An `allowIdpInitiated` member written into the stored OIDC
409+
configuration is not read, and it is removed on the next write.
410+
411+
### Accounts for people who were not invited
412+
413+
Under the `invite_only` audience posture (the default, see
414+
[Who may sign up](/docs/deployment/self-hosting#who-may-sign-up--and-what-each-posture-tells-a-stranger)),
415+
an SSO sign-in by a person who has no account and no pending invitation is
416+
refused. It redirects to the error page with `error=SELF_REGISTRATION_CLOSED`,
417+
and no user is created. These sign-ins are unchanged:
418+
419+
- a person who already has an account;
420+
- a person with a pending invitation;
421+
- the first human of a deployment that has none yet;
422+
- every sign-in under the `email_domain` or `open` posture.
423+
424+
To let a provider create accounts for everyone its IdP authenticates, as it did
425+
before this rule, turn on `allowJit` for that provider.
426+
427+
---
428+
371429
## Verify configuration
372430

373431
Restart the server (`pnpm dev`), then:

‎packages/platform-objects/src/apps/translations/ar.objects.generated.ts‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2047,6 +2047,14 @@ export const arObjects: NonNullable<TranslationData['objects']> = {
20472047
label: "تهيئة SAML",
20482048
help: "JSON: entryPoint، cert، identifierFormat، mapping (يديرها better-auth)"
20492049
},
2050+
allow_idp_initiated: {
2051+
label: "السماح بتسجيل الدخول الذي يبدأ من مزوّد الهوية",
2052+
help: "قبول تسجيل دخول يبدأ من مزوّد الهوية (استجابة SAML غير مطلوبة، أو استدعاء OIDC دون state) بدلًا من هذا النظام. معطّل افتراضيًا: استجابة SAML التي يبدأها مزوّد الهوية غير مرتبطة بأي طلب أرسله هذا النظام. غيّره من خلال «تعديل خيارات تسجيل الدخول»."
2053+
},
2054+
allow_jit: {
2055+
label: "السماح بالتزويد الفوري للحسابات",
2056+
help: "في وضع الجمهور المقتصر على الدعوات، إنشاء حساب لشخص يسجّل الدخول عبر هذا المزوّد دون حساب أو دعوة. معطّل افتراضيًا: يُرفض هذا الشخص. الأوضاع الأخرى تنشئ الحسابات كما كانت. غيّره من خلال «تعديل خيارات تسجيل الدخول»."
2057+
},
20502058
user_id: {
20512059
label: "سجّله",
20522060
help: "المستخدم الذي سجّل هذا المزوّد"
@@ -2167,6 +2175,10 @@ export const arObjects: NonNullable<TranslationData['objects']> = {
21672175
label: "حذف مزوّد SSO",
21682176
description: "هل تريد حذف مزوّد SSO هذا؟ لن يتمكن مستخدمو نطاقه من تسجيل الدخول من خلاله بعد ذلك.",
21692177
successMessage: "تم حذف مزوّد SSO"
2178+
},
2179+
edit_sso_sign_in_options: {
2180+
label: "تعديل خيارات تسجيل الدخول",
2181+
successMessage: "تم حفظ خيارات تسجيل الدخول"
21702182
}
21712183
}
21722184
},

‎packages/platform-objects/src/apps/translations/en.objects.generated.ts‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2047,6 +2047,14 @@ export const enObjects: NonNullable<TranslationData['objects']> = {
20472047
label: "SAML Config",
20482048
help: "JSON: entryPoint, cert, identifierFormat, mapping (managed by better-auth)"
20492049
},
2050+
allow_idp_initiated: {
2051+
label: "Allow IdP-Initiated Sign-In",
2052+
help: "Accept a sign-in that starts at the identity provider (an unsolicited SAML response, or an OIDC callback with no state) instead of at this system. Off by default: an IdP-initiated SAML response is not bound to any request this system made. Change it with “Edit Sign-In Options”."
2053+
},
2054+
allow_jit: {
2055+
label: "Allow Just-in-Time Provisioning",
2056+
help: "Under the invite-only audience posture, create an account for a person who signs in through this provider without an account or an invitation. Off by default: such a person is refused. Other postures provision as before. Change it with “Edit Sign-In Options”."
2057+
},
20502058
user_id: {
20512059
label: "Registered By",
20522060
help: "User who registered this provider"
@@ -2167,6 +2175,10 @@ export const enObjects: NonNullable<TranslationData['objects']> = {
21672175
label: "Delete SSO Provider",
21682176
description: "Delete this SSO provider? Users from its domain will no longer be able to sign in through it.",
21692177
successMessage: "SSO provider deleted"
2178+
},
2179+
edit_sso_sign_in_options: {
2180+
label: "Edit Sign-In Options",
2181+
successMessage: "Sign-in options saved"
21702182
}
21712183
}
21722184
},

‎packages/platform-objects/src/apps/translations/es-ES.objects.generated.ts‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2047,6 +2047,14 @@ export const esESObjects: NonNullable<TranslationData['objects']> = {
20472047
label: "Configuración SAML",
20482048
help: "JSON: entryPoint, cert, identifierFormat, mapeo (gestionado por better-auth)"
20492049
},
2050+
allow_idp_initiated: {
2051+
label: "Permitir inicio de sesión iniciado por el IdP",
2052+
help: "Acepta un inicio de sesión que empieza en el proveedor de identidad (una respuesta SAML no solicitada o una devolución de llamada OIDC sin state) en lugar de en este sistema. Desactivado de forma predeterminada: una respuesta SAML iniciada por el IdP no está vinculada a ninguna solicitud hecha por este sistema. Cámbielo con «Editar opciones de inicio de sesión»."
2053+
},
2054+
allow_jit: {
2055+
label: "Permitir aprovisionamiento just-in-time",
2056+
help: "Con la política de audiencia solo por invitación, crea una cuenta para quien inicia sesión a través de este proveedor sin cuenta ni invitación. Desactivado de forma predeterminada: esa persona es rechazada. Las demás políticas aprovisionan como antes. Cámbielo con «Editar opciones de inicio de sesión»."
2057+
},
20502058
user_id: {
20512059
label: "Registrado por",
20522060
help: "Usuario que registró este proveedor"
@@ -2167,6 +2175,10 @@ export const esESObjects: NonNullable<TranslationData['objects']> = {
21672175
label: "Eliminar proveedor SSO",
21682176
description: "¿Eliminar este proveedor SSO? Los usuarios de su dominio ya no podrán iniciar sesión a través de él.",
21692177
successMessage: "Proveedor SSO eliminado"
2178+
},
2179+
edit_sso_sign_in_options: {
2180+
label: "Editar opciones de inicio de sesión",
2181+
successMessage: "Opciones de inicio de sesión guardadas"
21702182
}
21712183
}
21722184
},

‎packages/platform-objects/src/apps/translations/fr.objects.generated.ts‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2047,6 +2047,14 @@ export const frObjects: NonNullable<TranslationData['objects']> = {
20472047
label: "Configuration SAML",
20482048
help: "JSON : entryPoint, cert, identifierFormat, mappage (géré par better-auth)"
20492049
},
2050+
allow_idp_initiated: {
2051+
label: "Autoriser la connexion initiée par l’IdP",
2052+
help: "Accepter une connexion qui commence chez le fournisseur d’identité (une réponse SAML non sollicitée, ou un rappel OIDC sans state) plutôt que dans ce système. Désactivé par défaut : une réponse SAML initiée par l’IdP n’est liée à aucune requête émise par ce système. Modifiez-le avec « Modifier les options de connexion »."
2053+
},
2054+
allow_jit: {
2055+
label: "Autoriser le provisionnement juste-à-temps",
2056+
help: "Avec la politique d’audience sur invitation uniquement, créer un compte pour une personne qui se connecte via ce fournisseur sans compte ni invitation. Désactivé par défaut : cette personne est refusée. Les autres politiques provisionnent comme avant. Modifiez-le avec « Modifier les options de connexion »."
2057+
},
20502058
user_id: {
20512059
label: "Enregistré par",
20522060
help: "Utilisateur qui a enregistré ce fournisseur"
@@ -2167,6 +2175,10 @@ export const frObjects: NonNullable<TranslationData['objects']> = {
21672175
label: "Supprimer le fournisseur SSO",
21682176
description: "Supprimer ce fournisseur SSO ? Les utilisateurs de son domaine ne pourront plus se connecter par son intermédiaire.",
21692177
successMessage: "Fournisseur SSO supprimé"
2178+
},
2179+
edit_sso_sign_in_options: {
2180+
label: "Modifier les options de connexion",
2181+
successMessage: "Options de connexion enregistrées"
21702182
}
21712183
}
21722184
},

‎packages/platform-objects/src/apps/translations/ja-JP.objects.generated.ts‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2047,6 +2047,14 @@ export const jaJPObjects: NonNullable<TranslationData['objects']> = {
20472047
label: "SAML 設定",
20482048
help: "JSON: entryPoint、cert、identifierFormat、マッピング(better-auth が管理)"
20492049
},
2050+
allow_idp_initiated: {
2051+
label: "IdP 起点のサインインを許可",
2052+
help: "本システムではなく ID プロバイダーから始まるサインイン(要求していない SAML レスポンス、または state のない OIDC コールバック)を受け入れます。既定ではオフです。IdP 起点の SAML レスポンスは、本システムが送ったどの要求にも結び付いていません。「サインインオプションを編集」で変更します。"
2053+
},
2054+
allow_jit: {
2055+
label: "ジャストインタイムのプロビジョニングを許可",
2056+
help: "招待制のオーディエンス方針のもとで、アカウントも招待もないままこのプロバイダー経由でサインインした人のアカウントを作成します。既定ではオフで、そのような人は拒否されます。ほかの方針では従来どおりプロビジョニングされます。「サインインオプションを編集」で変更します。"
2057+
},
20502058
user_id: {
20512059
label: "登録者",
20522060
help: "このプロバイダーを登録したユーザー"
@@ -2167,6 +2175,10 @@ export const jaJPObjects: NonNullable<TranslationData['objects']> = {
21672175
label: "SSO プロバイダーを削除",
21682176
description: "この SSO プロバイダーを削除しますか?そのドメインのユーザーは、これを通じてサインインできなくなります。",
21692177
successMessage: "SSO プロバイダーを削除しました"
2178+
},
2179+
edit_sso_sign_in_options: {
2180+
label: "サインインオプションを編集",
2181+
successMessage: "サインインオプションを保存しました"
21702182
}
21712183
}
21722184
},

‎packages/platform-objects/src/apps/translations/zh-CN.objects.generated.ts‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2047,6 +2047,14 @@ export const zhCNObjects: NonNullable<TranslationData['objects']> = {
20472047
label: "SAML 配置",
20482048
help: "JSON:entryPoint、cert、identifierFormat、映射(由 better-auth 管理)"
20492049
},
2050+
allow_idp_initiated: {
2051+
label: "允许 IdP 发起的登录",
2052+
help: "接受从身份提供方发起的登录(未经请求的 SAML 响应,或不带 state 的 OIDC 回调),而不是从本系统发起的登录。默认关闭:IdP 发起的 SAML 响应不对应本系统发出的任何请求。请通过“编辑登录选项”修改。"
2053+
},
2054+
allow_jit: {
2055+
label: "允许即时开通账号",
2056+
help: "在仅限邀请的受众策略下,为通过此提供方登录、但既无账号也无邀请的人创建账号。默认关闭:此类人员会被拒绝。其他策略照旧开通账号。请通过“编辑登录选项”修改。"
2057+
},
20502058
user_id: {
20512059
label: "注册人",
20522060
help: "注册该提供方的用户"
@@ -2167,6 +2175,10 @@ export const zhCNObjects: NonNullable<TranslationData['objects']> = {
21672175
label: "删除 SSO 提供方",
21682176
description: "删除该 SSO 提供方吗?其域名下的用户将无法再通过它登录。",
21692177
successMessage: "SSO 提供方已删除"
2178+
},
2179+
edit_sso_sign_in_options: {
2180+
label: "编辑登录选项",
2181+
successMessage: "登录选项已保存"
21702182
}
21712183
}
21722184
},

‎packages/platform-objects/src/apps/translations/zh-Hant.objects.generated.ts‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2047,6 +2047,14 @@ export const zhHantObjects: NonNullable<TranslationData['objects']> = {
20472047
label: "SAML 設定",
20482048
help: "JSON:entryPoint、cert、identifierFormat、對應(由 better-auth 管理)"
20492049
},
2050+
allow_idp_initiated: {
2051+
label: "允許 IdP 發起的登入",
2052+
help: "接受從身分提供方發起的登入(未經請求的 SAML 回應,或不帶 state 的 OIDC 回呼),而非從本系統發起的登入。預設關閉:IdP 發起的 SAML 回應不對應本系統發出的任何請求。請透過「編輯登入選項」修改。"
2053+
},
2054+
allow_jit: {
2055+
label: "允許即時開通帳號",
2056+
help: "在僅限邀請的受眾策略下,為透過此提供方登入、但既無帳號也無邀請的人建立帳號。預設關閉:此類人員會被拒絕。其他策略照舊開通帳號。請透過「編輯登入選項」修改。"
2057+
},
20502058
user_id: {
20512059
label: "註冊者",
20522060
help: "註冊該提供方的使用者"
@@ -2167,6 +2175,10 @@ export const zhHantObjects: NonNullable<TranslationData['objects']> = {
21672175
label: "刪除 SSO 提供方",
21682176
description: "刪除該 SSO 提供方嗎?其網域下的使用者將無法再透過它登入。",
21692177
successMessage: "SSO 提供方已刪除"
2178+
},
2179+
edit_sso_sign_in_options: {
2180+
label: "編輯登入選項",
2181+
successMessage: "登入選項已儲存"
21702182
}
21712183
}
21722184
},

0 commit comments

Comments
 (0)