You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit b18ebf3
Browse filesBrowse the repository at this point in the historyBrowse files
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.
Copy file name to clipboardExpand all lines: content/docs/permissions/sso.mdx
+58Lines changed: 58 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -368,6 +368,64 @@ configure on the IdP side:
368
368
369
369
---
370
370
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.
label: "السماح بتسجيل الدخول الذي يبدأ من مزوّد الهوية",
2052
+
help: "قبول تسجيل دخول يبدأ من مزوّد الهوية (استجابة SAML غير مطلوبة، أو استدعاء OIDC دون state) بدلًا من هذا النظام. معطّل افتراضيًا: استجابة SAML التي يبدأها مزوّد الهوية غير مرتبطة بأي طلب أرسله هذا النظام. غيّره من خلال «تعديل خيارات تسجيل الدخول»."
2053
+
},
2054
+
allow_jit: {
2055
+
label: "السماح بالتزويد الفوري للحسابات",
2056
+
help: "في وضع الجمهور المقتصر على الدعوات، إنشاء حساب لشخص يسجّل الدخول عبر هذا المزوّد دون حساب أو دعوة. معطّل افتراضيًا: يُرفض هذا الشخص. الأوضاع الأخرى تنشئ الحسابات كما كانت. غيّره من خلال «تعديل خيارات تسجيل الدخول»."
help: "JSON: entryPoint, cert, identifierFormat, mapping (managed by better-auth)"
2049
2049
},
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”."
help: "JSON: entryPoint, cert, identifierFormat, mapeo (gestionado por better-auth)"
2049
2049
},
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»."
help: "JSON : entryPoint, cert, identifierFormat, mappage (géré par better-auth)"
2049
2049
},
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
+
},
2050
2058
user_id: {
2051
2059
label: "Enregistré par",
2052
2060
help: "Utilisateur qui a enregistré ce fournisseur"
0 commit comments