@absolutejs/auth 0.51.0 → 0.52.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/dist/index.js CHANGED
@@ -6951,6 +6951,21 @@ var oidcProviderRoutes = (config) => {
6951
6951
  return loginUrl === undefined ? jsonResponse({ error: "login_required" }, HTTP_UNAUTHORIZED2) : redirectTo(`${loginUrl}?return_to=${encodeURIComponent(request.url)}`);
6952
6952
  }
6953
6953
  const requested = scope === undefined || scope.length === 0 ? client.scopes : scope.split(" ").filter((entry) => client.scopes.includes(entry));
6954
+ if (config.consentUrl !== undefined && await config.needsConsent?.({
6955
+ client: {
6956
+ clientId: client.clientId,
6957
+ name: client.name
6958
+ },
6959
+ requestedScopes: requested,
6960
+ user: userSession.user
6961
+ }) === true) {
6962
+ const consentTarget = new URL(config.consentUrl, issuer);
6963
+ consentTarget.searchParams.set("return_to", request.url);
6964
+ consentTarget.searchParams.set("client_id", client.clientId);
6965
+ consentTarget.searchParams.set("client_name", client.name);
6966
+ consentTarget.searchParams.set("scope", requested.join(" "));
6967
+ return redirectTo(consentTarget.toString());
6968
+ }
6954
6969
  const granted = getGrantedScopes === undefined ? requested : await getGrantedScopes({
6955
6970
  client: {
6956
6971
  clientId: client.clientId,
@@ -7449,7 +7464,7 @@ var oidcProviderRoutes = (config) => {
7449
7464
  headers: t13.Object({
7450
7465
  authorization: t13.Optional(t13.String())
7451
7466
  })
7452
- }).get(jwksRoute, () => ({ keys: [toPublicJwk(signingKey)] })).get("/.well-known/openid-configuration", () => discovery);
7467
+ }).get(jwksRoute, () => ({ keys: [toPublicJwk(signingKey)] })).get("/.well-known/openid-configuration", () => discovery).get("/.well-known/oauth-authorization-server", () => discovery);
7453
7468
  };
7454
7469
 
7455
7470
  // src/organizations/routes.ts
@@ -28028,5 +28043,5 @@ export {
28028
28043
  AuthIdentityConflictError
28029
28044
  };
28030
28045
 
28031
- //# debugId=CF57DC7D601D3EC464756E2164756E21
28046
+ //# debugId=1C44E17EB1F4FC5164756E2164756E21
28032
28047
  //# sourceMappingURL=index.js.map