@udibo/oauth2 0.8.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -76,6 +76,11 @@ a browser app with a backend, start with the BFF guide.
|
|
|
76
76
|
authorization server. The framework-independent core accepts standard `Request`
|
|
77
77
|
and `Response` objects; Hono adapters add routing and middleware.
|
|
78
78
|
|
|
79
|
+
For app-owned login, `CaptchaProvider` and `verifyCaptcha` let your route check
|
|
80
|
+
a client-issued bot-challenge token before calling `IdentityService`. The
|
|
81
|
+
package does not include a challenge provider; see the
|
|
82
|
+
[CAPTCHA route example](docs/guides/add-login.md#captcha-at-the-route-boundary).
|
|
83
|
+
|
|
79
84
|
## Examples
|
|
80
85
|
|
|
81
86
|
From a checkout of this repository:
|
|
@@ -63,9 +63,19 @@ export interface EndSessionContext<Client extends ClientInterface> {
|
|
|
63
63
|
}
|
|
64
64
|
/** What an app's {@link EndSessionFn} may ask the server to do afterwards. */
|
|
65
65
|
export interface EndSessionResult {
|
|
66
|
+
/**
|
|
67
|
+
* The app refused this logout (for example, the verified `id_token_hint`
|
|
68
|
+
* names a different person than the current session). Ignore the caller's
|
|
69
|
+
* redirect and all `headers`, including any `Set-Cookie`, so the response
|
|
70
|
+
* neither sends the browser to the RP nor clears the current session.
|
|
71
|
+
* Answer at `fallback` if supplied, otherwise 204. Omit or set `false` to
|
|
72
|
+
* preserve the normal logout behavior.
|
|
73
|
+
*/
|
|
74
|
+
refused?: boolean;
|
|
66
75
|
/**
|
|
67
76
|
* Headers to merge into the response — the session-clearing `Set-Cookie`,
|
|
68
|
-
* typically. The server owns `Location`; anything else is yours.
|
|
77
|
+
* typically. The server owns `Location`; anything else is yours. Ignored
|
|
78
|
+
* when `refused` is true.
|
|
69
79
|
*/
|
|
70
80
|
headers?: HeadersInit;
|
|
71
81
|
/**
|
|
@@ -580,8 +580,10 @@ export class AuthorizationServer extends ResourceServer {
|
|
|
580
580
|
subject: params.subject,
|
|
581
581
|
logoutHint: params.logoutHint,
|
|
582
582
|
}) ?? {};
|
|
583
|
-
const headers = new Headers(result.headers);
|
|
584
|
-
const authorized =
|
|
583
|
+
const headers = new Headers(result.refused ? undefined : result.headers);
|
|
584
|
+
const authorized = result.refused
|
|
585
|
+
? undefined
|
|
586
|
+
: this.#postLogoutRedirect(client, params);
|
|
585
587
|
const target = authorized ?? result.fallback;
|
|
586
588
|
if (!target)
|
|
587
589
|
return new Response(null, { status: 204, headers });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@udibo/oauth2",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"description": "A flexible OAuth2 toolkit: framework-agnostic authorization & resource servers, a typed client, Hono adapters (including a backend-for-frontend), and React bindings.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|