Skip to content

Commit df649f3

Browse files
lulululu-debughsluoyz
authored andcommitted
fix: add docs for 10 commits starting from 9ad2b8ca (2026-06-17) (#1011)
1 parent 235a1e2 commit df649f3

9 files changed

Lines changed: 134 additions & 3 deletions

File tree

docs/application/dynamic-client-registration.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,14 @@ Your registration request needs at least one redirect URI. Everything else is op
7575

7676
Applications created through DCR get a 7-day token expiration and are tagged with `dcr` for easy identification in the admin interface.
7777

78+
## Managing a registered client
79+
80+
Casdoor also implements [RFC 7592](https://datatracker.ietf.org/doc/html/rfc7592) so a client can read, update, or delete its own registration at `/api/oauth/register/{client_id}`:
81+
82+
- `GET /api/oauth/register/{client_id}` — read the client's current metadata.
83+
- `PUT /api/oauth/register/{client_id}` — update the client's metadata.
84+
- `DELETE /api/oauth/register/{client_id}` — delete the client.
85+
7886
## Controlling DCR Per Organization
7987

8088
Organizations control whether DCR is available through the `dcrPolicy` setting on the organization configuration page. Two values are supported:

docs/application/terminology.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ The application edit page is split into eight tabs. Fields below are grouped by
5151
- **Scopes** — Custom scopes for Agent-category apps (name, display name, description); exposed in OIDC discovery.
5252
- **Token format**`JWT`, `JWT-Empty`, `JWT-Custom`, or `JWT-Standard`. See [Token overview](/docs/token/overview).
5353
- **Token signing method** — Signing algorithm: RS256, RS512, ES256, ES384, or ES512.
54-
- **Token fields**Additional user fields included in the token payload (available when format is `JWT-Custom`).
54+
- **Token fields**User fields included in the token payload (available when format is `JWT-Custom`). This list also acts as a whitelist for the `/userinfo` endpoint: when non-empty, only the listed fields are returned. Leave empty to include the full set. See [Token overview](/docs/token/overview#restricting-fields-with-token-fields).
5555
- **Token attributes** — Custom claims added to the token (available when format is `JWT-Custom`). Each row has a **Category**, **Value**, and **Type**:
5656
- **Category: Static Value** — the Value field is a template string (supports `${user.xxx}` substitution). Type controls whether the claim is a `String` or `Array`.
5757
- **Category: Existing Field** — the Value field is a dropdown of known user fields (`Owner`, `Name`, `Id`, `DisplayName`, `Email`, `Phone`, `Tag`, `Roles`, `Permissions`, `Groups`, etc.). Casdoor reads the field directly from the user object at token issuance. Properties sub-fields are referenced as `Properties.<key>`.

docs/how-to-connect/oauth.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,14 @@ Casdoor provides a built-in device login page at the `verification_uri` where th
193193

194194
Second, you should request `token endpoint` to get Access Token with parameter define in [rfc8628](https://datatracker.ietf.org/doc/html/rfc8628#section-3.4).
195195

196+
:::info Multi-replica deployments
197+
198+
The pending device-authorization requests (the mapping between the device code and the user code) are held in an in-memory store by default. In a multi-replica / horizontally-scaled deployment, the polling request from the device and the browser confirmation may land on different replicas, so an in-memory store causes the device flow to fail intermittently.
199+
200+
To make the device flow work across replicas, configure `redisEndpoint` in `conf/app.conf`. When it is set, Casdoor automatically backs the device-authorization store with Redis so all replicas share the same state. No extra configuration key is needed — the same `redisEndpoint` value used for shared sessions is reused (format: `host:port[,db[,password]]`). If Redis cannot be reached at startup, Casdoor logs a warning and falls back to the in-memory store. See [Configuration](/docs/basic/configuration).
201+
202+
:::
203+
196204
### Resource Owner Password Credentials Grant
197205

198206
If your application doesn't have a frontend that redirects users to Casdoor, then you may need this.

docs/provider/faceid/overview.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,7 @@ Casdoor supports Face ID as a sign-in method. Only enable it when you can ensure
1111

1212
1. Open the Casdoor admin UI → **Providers****Add**.
1313
2. Set **Category** to **Face ID**.
14-
3. Choose the **Type** (e.g. Alibaba Cloud FaceBody).
15-
4. Fill in the required fields (e.g. **Client ID**, **Client Secret**, **Endpoint** as needed) and save.
14+
3. Choose the **Type**:
15+
- **Alibaba Cloud Facebody** — cloud face recognition (requires the provider's credentials/endpoint).
16+
- **Local UniFace** — on-device face recognition using the [UniFace](https://github.com/yakhyo/uniface) model, with no external service.
17+
4. Fill in the required fields (e.g. **Client ID**, **Client Secret**, **Endpoint** for cloud types) and save.

docs/provider/oauth/telegram.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,9 @@ With the setup completed, users can now log in with Telegram.
5050
## Authentication flow
5151

5252
Users sign in via Telegram’s login widget; Casdoor validates the HMAC-SHA256 signature and timestamp per [Telegram’s spec](https://core.telegram.org/widgets/login#checking-authorization). Profile data includes user ID, name, username, and optional photo. Telegram does not provide email via the widget; collect email separately if needed.
53+
54+
:::note Users without a Telegram username
55+
56+
A Telegram username (`@handle`) is optional, so some accounts do not have one. When a user without a public username signs in, Casdoor generates a stable fallback username of the form `telegram_<user_id>` (for example `telegram_123456789`), derived from the account's numeric Telegram ID. Because the ID is stable, the same person keeps the same generated username across logins.
57+
58+
:::
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
---
2+
title: RP-initiated logout
3+
description: Log a user out of Casdoor from a relying party using the OIDC RP-Initiated Logout endpoint.
4+
keywords: [OIDC, RP-initiated logout, end session, logout, id_token_hint, post_logout_redirect_uri]
5+
authors: [hsluoyz]
6+
---
7+
8+
## Overview
9+
10+
**RP-Initiated Logout** lets a relying party (RP, i.e. your client application) log the user out of Casdoor and, optionally, redirect the browser back to the application afterward. It follows the [OpenID Connect RP-Initiated Logout 1.0](https://openid.net/specs/openid-connect-rpinitiated-1_0-final.html) specification.
11+
12+
This is the endpoint an OIDC client calls as its "end session" endpoint. It differs from [single sign-out](/docs/session/single-sign-out), which terminates every session in the organization at once.
13+
14+
## Endpoint
15+
16+
```text
17+
GET /api/logout
18+
POST /api/logout
19+
```
20+
21+
| Parameter | Required | Description |
22+
|---|---|---|
23+
| `id_token_hint` | Recommended | The ID token (`id_token`) that Casdoor previously issued to the user. When present, Casdoor uses it to identify and expire the exact token/session. |
24+
| `post_logout_redirect_uri` | Optional | Where to send the browser after logout. Must be registered in the application's **Redirect URLs** list, otherwise the request is rejected. |
25+
| `client_id` | Optional | The client ID of the application. Used to resolve the application when `id_token_hint` is omitted and the application cannot be determined from the current session. |
26+
| `state` | Optional | An opaque value echoed back as a `state` query parameter appended to `post_logout_redirect_uri`. |
27+
28+
:::info
29+
30+
Per the OIDC spec, `id_token_hint` is **RECOMMENDED, not REQUIRED**. Casdoor therefore accepts logout requests without it and falls back to the user's current browser session. Some clients (for example, [Gitea](https://github.com/casdoor/casdoor/issues/5607)) only send `post_logout_redirect_uri` (optionally with `client_id`) — these requests are supported.
31+
32+
:::
33+
34+
## Behavior
35+
36+
Casdoor selects one of two paths depending on whether `id_token_hint` is provided.
37+
38+
### With `id_token_hint`
39+
40+
1. The token identified by `id_token_hint` is expired.
41+
2. The current browser session is cleared and a back-channel logout notification is sent to other applications.
42+
3. If `post_logout_redirect_uri` is present and valid for the application, the browser is redirected there (with `state` appended when supplied). Otherwise the endpoint returns `200 OK`.
43+
44+
### Without `id_token_hint`
45+
46+
1. If there is no active session, the endpoint returns `200 OK` and does nothing (the user is already logged out).
47+
2. Otherwise Casdoor logs out the current session. The application is resolved from the session first, and falls back to the one identified by `client_id` when provided.
48+
3. The session and its token are cleared and a back-channel logout notification is sent.
49+
4. If `post_logout_redirect_uri` is present and valid for the application, the browser is redirected there (with `state` appended when supplied).
50+
5. If no `post_logout_redirect_uri` is given, Casdoor returns `200 OK`, including the application's homepage URL when one is configured (except for the built-in application).
51+
52+
## Redirect URI validation
53+
54+
`post_logout_redirect_uri` is always validated against the target application's registered **Redirect URLs**. If the URI is not in that list — or the application cannot be resolved — Casdoor rejects the request with an error instead of redirecting. This prevents open-redirect abuse. Make sure your post-logout URL is added to the application's Redirect URLs.
55+
56+
## Examples
57+
58+
Log out using the ID token and return to the app:
59+
60+
```text
61+
GET /api/logout?id_token_hint=<ID_TOKEN>&post_logout_redirect_uri=https://myapp.example.com/logged-out&state=xyz
62+
```
63+
64+
Log out based on the current session, resolving the app by `client_id` (no `id_token_hint`):
65+
66+
```text
67+
GET /api/logout?client_id=<CLIENT_ID>&post_logout_redirect_uri=https://myapp.example.com/logged-out
68+
```
69+
70+
## See also
71+
72+
- [Single sign-out (SSO logout)](/docs/session/single-sign-out) — terminate every session in the organization at once.
73+
- [Session management](/docs/session/management)

docs/token/overview.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,21 @@ The token format options behave as follows:
6262

6363
:::
6464

65+
## Restricting fields with Token fields
66+
67+
The **Token fields** setting on the application (used to pick custom user attributes for the `JWT-Custom` format) also acts as a **whitelist for the `/userinfo` endpoint**.
68+
69+
- When **Token fields is empty**, no whitelist is applied: the token payload and the `/userinfo` response include their full default set of fields. This is the default behavior.
70+
- When **Token fields lists one or more fields**, only those fields are returned. Any user attribute not in the list is omitted from **both** the `JWT-Custom` token payload and the `/userinfo` response.
71+
72+
The whitelist is matched against the underlying user-property names. For example, to expose the display name, email, and avatar through `/userinfo`, add `Name`, `Email`, and `Avatar` to Token fields. Fields still respect the requested OAuth scopes — for instance `Email` is only returned when the `email` scope is granted, `Location` (the `address` claim) only with the `address` scope, and `Phone` only with the `phone` scope. The `sub` and `aud` claims are always returned regardless of the whitelist.
73+
74+
:::caution
75+
76+
Configuring Token fields restricts `/userinfo`, not only the token. If you previously relied on `/userinfo` returning every field, adding entries here will start filtering that response. Leave Token fields empty to keep the full response.
77+
78+
:::
79+
6580
## OIDC Address Claim
6681

6782
The [OIDC specification](https://openid.net/specs/openid-connect-core-1_0.html#AddressClaim) defines the `address` claim as a JSON object with the following fields:

docs/webhooks/overview.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,23 @@ Example JSON sent to your webhook on login:
9696

9797
Your application should parse this payload and perform necessary actions, such as logging the event or notifying another service.
9898

99+
### Sign-in failure classification
100+
101+
Every sign-in attempt is stored as a record (visible under **Records** in the admin console and delivered with the webhook payload). When a sign-in **fails**, Casdoor fills the record's `detail` field with a stable, machine-readable reason so you can classify failures without parsing localized error messages.
102+
103+
Possible reasons are:
104+
105+
| `detail` | Meaning |
106+
|---|---|
107+
| `user-not-found` | No matching user for the supplied identifier. |
108+
| `account-disabled` | The user account is disabled (forbidden). |
109+
| `account-frozen` | The user account is frozen/locked. |
110+
| `wrong-password` | The password did not match. |
111+
| `password-expired` | The password has expired and must be reset. |
112+
| `mfa-failed` | Multi-factor authentication verification failed. |
113+
114+
Successful sign-ins leave `detail` empty. Use these values to build audit dashboards, alerting (for example, spikes in `wrong-password`), or lockout logic keyed on a specific failure reason.
115+
99116
## Testing webhooks
100117

101118
Before production, test with:

sidebars.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ module.exports = {
6060
"how-to-connect/sdk",
6161
"session/single-sign-on",
6262
"session/single-sign-out",
63+
"session/rp-initiated-logout",
6364
"how-to-connect/vue-sdk",
6465
{
6566
type: "category",
@@ -546,6 +547,7 @@ module.exports = {
546547
"session/management",
547548
"session/single-sign-on",
548549
"session/single-sign-out",
550+
"session/rp-initiated-logout",
549551
],
550552
},
551553
{

0 commit comments

Comments
 (0)