refactor(auth): unify OIDC provisioning under shared default_tenant_mode policy
Drop the standalone OIDC_AUTH_DEFAULT_TENANT_MODE / oidc_auth.default_tenant_mode knob so OIDC auto-provisioning and local password registration share the single auth.default_tenant_mode policy (resolved by the callback handler). Repair tenantless sessions by falling back to the first active membership on the login happy path and stale-preference paths, allow tenantless PUT /auth/me/preferences, clear the tenant snapshot on /auth/me responses without a tenant, and default the frontend canCreateTenant capability to fail-closed until /auth/me confirms it.
This commit is contained in:
+3
-1
@@ -314,11 +314,13 @@ GET /api/v1/auth/oidc/callback
|
||||
若 `state` 与 `code` 都合法,则调用:
|
||||
|
||||
```go
|
||||
LoginWithOIDC(ctx, code, decodedState.RedirectURI)
|
||||
LoginWithOIDC(ctx, code, decodedState.RedirectURI, h.resolveDefaultTenantMode(ctx))
|
||||
```
|
||||
|
||||
注意这里传入的是 **state 中保存的 redirect_uri**,而不是重新拼接的地址,这样保证了 code 交换时使用的 `redirect_uri` 和授权时完全一致。
|
||||
|
||||
第四个参数是首次自动开户时的默认租户策略,由 `resolveDefaultTenantMode` 从 `auth.default_tenant_mode`(SystemSetting,DB > `WEKNORA_AUTH_DEFAULT_TENANT_MODE` > 配置文件)解析,与本地密码注册共用同一开关;OIDC 不再有独立的 `OIDC_AUTH_DEFAULT_TENANT_MODE`。
|
||||
|
||||
---
|
||||
|
||||
## 7. 后端用 code 换 token 并解析用户身份
|
||||
|
||||
Reference in New Issue
Block a user