@udibo/oauth2 0.45.0 → 0.45.1

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.
@@ -354,10 +354,13 @@ export interface RotatedOutRevocationEvent<Client extends ClientInterface, User>
354
354
  * pre-authorized for this client; consent is needed unless it covers the
355
355
  * whole accepted scope (the requested scope after the token service's
356
356
  * `acceptedScope`). **Omitting `authorizedScope` means
357
- * "nothing pre-authorized"** — so any requested scope needs consent: the
358
- * framework calls `handleConsent` when one is configured, and otherwise
359
- * treats the request as consented and grants the accepted scope. To
360
- * pre-authorize everything, return the requested scope as `authorizedScope`.
357
+ * "nothing pre-authorized"** — so every request needs consent, including
358
+ * one that names no scope: the framework calls `handleConsent` when one is
359
+ * configured, and otherwise treats the request as consented and grants the
360
+ * accepted scope. An empty scope (`new BasicScope("")`) is a real grant
361
+ * that lets a scope-less request skip consent, so return `undefined`, not
362
+ * an empty scope, for a user with no grant on record. To pre-authorize
363
+ * everything, return the requested scope as `authorizedScope`.
361
364
  * Supply only verified event claims in `authenticationContext`; the code,
362
365
  * token and refresh descendants retain a snapshot. Omit unknown claims.
363
366
  * Set `reauthenticated: true` only when the user actively authenticated in
@@ -948,7 +948,8 @@ export class AuthorizationServer extends ResourceServer {
948
948
  throw new ConsentRequiredError("prompt=consent requires a consent handler");
949
949
  }
950
950
  const needsConsent = forceConsent ||
951
- (scope !== undefined && !(authorizedScope && authorizedScope.has(scope)));
951
+ authorizedScope === undefined ||
952
+ (scope !== undefined && !authorizedScope.has(scope));
952
953
  if (needsConsent && handleConsent) {
953
954
  const consent = await handleConsent(client, scope, user, authentication);
954
955
  if (consent instanceof Response) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@udibo/oauth2",
3
- "version": "0.45.0",
3
+ "version": "0.45.1",
4
4
  "description": "A flexible OAuth2 toolkit: framework-agnostic authorization & resource servers, a typed client, Hono adapters (including a backend-for-frontend), Express adapters, and React bindings.",
5
5
  "keywords": [
6
6
  "authorization-server",