@eventuras/fides-auth 0.4.0 → 0.5.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/oauth.d.ts CHANGED
@@ -10,6 +10,14 @@ export type OAuthConfig = {
10
10
  clientSecret: string;
11
11
  redirect_uri: string;
12
12
  scope: string;
13
+ /**
14
+ * Opt in to Pushed Authorization Requests (RFC 9126) when the provider
15
+ * supports it. When true, authorization parameters are posted to the
16
+ * provider's PAR endpoint ahead of the redirect, and only `client_id` +
17
+ * `request_uri` travel through the user-agent. The provider must advertise
18
+ * `pushed_authorization_request_endpoint` in its discovery metadata.
19
+ */
20
+ usePar?: boolean;
13
21
  };
14
22
  /**
15
23
  * Refreshes an access token using a refresh token grant.
@@ -46,8 +54,27 @@ export declare function buildPKCEOptions(config: OAuthConfig): Promise<PKCEOptio
46
54
  */
47
55
  export declare function buildAuthorizationUrl(config: openid.Configuration, pkceOptions: PKCEOptions): Promise<URL>;
48
56
  /**
49
- * Convenience function to discover OpenID configuration and build authorization URL.
50
- * This combines discovery + buildAuthorizationUrl in one call.
57
+ * Builds an authorization URL using Pushed Authorization Requests (RFC 9126).
58
+ *
59
+ * Posts the PKCE parameters to the provider's PAR endpoint and returns a URL
60
+ * containing only `client_id` and `request_uri`. The provider's discovery
61
+ * metadata must include `pushed_authorization_request_endpoint`.
62
+ *
63
+ * @param config - Discovered OpenID Configuration (use openid.discovery() to obtain)
64
+ * @param pkceOptions - The PKCE options (e.g., code challenge, state, parameters)
65
+ * @returns A Promise that resolves to the PAR-based authorization URL
66
+ */
67
+ export declare function buildAuthorizationUrlWithPAR(config: openid.Configuration, pkceOptions: PKCEOptions): Promise<URL>;
68
+ /**
69
+ * Convenience function to discover OpenID configuration and build an
70
+ * authorization URL. Routes through PAR when `oauthConfig.usePar` is true and
71
+ * the provider advertises `pushed_authorization_request_endpoint`.
72
+ *
73
+ * - `usePar === true` + provider advertises PAR → uses PAR.
74
+ * - `usePar === true` + provider does **not** advertise PAR → throws.
75
+ * - `usePar` unset/false + provider advertises PAR → standard flow + one-line
76
+ * `info` advisory that PAR is available but not enabled.
77
+ * - `usePar` unset/false + no PAR endpoint → standard flow, no advisory.
51
78
  *
52
79
  * @param oauthConfig - Your OAuth configuration
53
80
  * @param pkceOptions - The PKCE options (e.g., code challenge, state, parameters)
@@ -1 +1 @@
1
- {"version":3,"file":"oauth.d.ts","sourceRoot":"","sources":["../src/oauth.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAGxC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAKvC,YAAY,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAE1E,uFAAuF;AACvF,eAAO,MAAM,YAAY,wCAAwC,CAAC;AAElE,wDAAwD;AACxD,MAAM,MAAM,WAAW,GAAG;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF;;;;;;GAMG;AACH,wBAAsB,kBAAkB,CACtC,WAAW,EAAE,WAAW,EACxB,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC,MAAM,CAAC,qBAAqB,CAAC,CA6CvC;AAED,8DAA8D;AAC9D,MAAM,WAAW,WAAW;IAC1B,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACpC;AAED;;;;;;;;;GASG;AACH,wBAAsB,gBAAgB,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC,CAmBhF;AAED;;;;;;GAMG;AACH,wBAAsB,qBAAqB,CACzC,MAAM,EAAE,MAAM,CAAC,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AAsB,CACpC,MAAM,EAAE,MAAM,CAAC,qBAAqB,EACpC,UAAU,GAAE,MAAgB,GAC3B,OAAO,CAqBT;AAED;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EACnC,iBAAiB,EAAE,MAAM,EACzB,WAAW,GAAE,MAAY,EACzB,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,GACvC,GAAG,CA+BL;AAED;;;;;;;GAOG;AACH,wBAAsB,kBAAkB,CACtC,WAAW,EAAE,WAAW,EACxB,qBAAqB,EAAE,MAAM,GAC5B,OAAO,CAAC,GAAG,GAAG,IAAI,CAAC,CAyBrB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,sBAAsB,CAC1C,MAAM,EAAE,uBAAuB,GAC9B,OAAO,CAAC,MAAM,CAAC,qBAAqB,CAAC,CAgCvC"}
package/dist/oauth.js CHANGED
@@ -1,85 +1,98 @@
1
1
  import { createLogger as e } from "./logger.js";
2
2
  import { t } from "./decode_jwt-1J26fl4I.js";
3
- import { a as n, c as r, i, n as a, o, r as s, s as c, t as l } from "./build-BnXr85C9.js";
3
+ import { a as n, c as r, i, l as a, n as o, o as s, r as c, s as l, t as u } from "./build-nL2--iMi.js";
4
4
  //#region src/oauth.ts
5
- var u = e({ namespace: "fides-auth:oauth" }), d = "openid profile email offline_access";
6
- async function f(e, t) {
7
- u.debug({ issuer: e.issuer }, "Starting token refresh");
5
+ var d = e({ namespace: "fides-auth:oauth" }), f = "openid profile email offline_access";
6
+ async function p(e, t) {
7
+ d.debug({ issuer: e.issuer }, "Starting token refresh");
8
8
  try {
9
- let i = await r(await n(new URL(e.issuer), e.clientId, e.clientSecret, l(e.clientSecret)), t, { scope: e.scope });
10
- return u.info({
11
- hasAccessToken: !!i.access_token,
12
- hasRefreshToken: !!i.refresh_token,
13
- expiresIn: i.expires_in
14
- }, "Token refresh successful"), i;
9
+ let n = await a(await s(new URL(e.issuer), e.clientId, e.clientSecret, u(e.clientSecret)), t, { scope: e.scope });
10
+ return d.info({
11
+ hasAccessToken: !!n.access_token,
12
+ hasRefreshToken: !!n.refresh_token,
13
+ expiresIn: n.expires_in
14
+ }, "Token refresh successful"), n;
15
15
  } catch (t) {
16
16
  let n = t;
17
- throw n?.code === "OAUTH_RESPONSE_BODY_ERROR" && n?.error === "invalid_grant" ? u.info({
17
+ throw n?.code === "OAUTH_RESPONSE_BODY_ERROR" && n?.error === "invalid_grant" ? d.info({
18
18
  error: n.error,
19
19
  error_description: n.error_description,
20
20
  issuer: e.issuer
21
- }, "Token refresh failed - refresh token expired or invalid") : u.error({
21
+ }, "Token refresh failed - refresh token expired or invalid") : d.error({
22
22
  error: t,
23
23
  issuer: e.issuer
24
24
  }, "Token refresh failed"), t;
25
25
  }
26
26
  }
27
- async function p(e) {
28
- let t = o(), n = await i(t), r = c(), a = {
27
+ async function m(e) {
28
+ let t = l(), i = await n(t), a = r(), o = {
29
29
  redirect_uri: e.redirect_uri,
30
30
  scope: e.scope ?? "openid profile email offline_access",
31
- code_challenge: n,
31
+ code_challenge: i,
32
32
  code_challenge_method: "S256",
33
- state: r
33
+ state: a
34
34
  };
35
- return u.info({
35
+ return d.info({
36
36
  redirectUri: e.redirect_uri,
37
- scope: a.scope
37
+ scope: o.scope
38
38
  }, "PKCE parameters generated"), {
39
39
  code_verifier: t,
40
- code_challenge: n,
41
- state: r,
42
- parameters: a
40
+ code_challenge: i,
41
+ state: a,
42
+ parameters: o
43
43
  };
44
44
  }
45
- async function m(e, t) {
45
+ async function h(e, t) {
46
46
  try {
47
- let n = s(e, t.parameters);
48
- return u.info({ authUrl: n.origin }, "Authorization URL built successfully"), n;
47
+ let n = c(e, t.parameters);
48
+ return d.info("Authorization URL built successfully"), n;
49
49
  } catch (e) {
50
- throw u.error({ error: e }, "Failed to build authorization URL"), e;
50
+ throw d.error({ error: e }, "Failed to build authorization URL"), e;
51
51
  }
52
52
  }
53
- async function h(e, t) {
54
- u.debug({ issuer: e.issuer }, "Discovering OpenID configuration");
53
+ async function g(e, t) {
55
54
  try {
56
- return m(await n(new URL(e.issuer), e.clientId, e.clientSecret, l(e.clientSecret)), t);
55
+ let n = await i(e, t.parameters);
56
+ return d.info("PAR authorization URL built successfully"), n;
57
+ } catch (e) {
58
+ throw d.error({ error: e }, "Failed to build PAR authorization URL"), e;
59
+ }
60
+ }
61
+ async function _(e, t) {
62
+ d.debug({ issuer: e.issuer }, "Discovering OpenID configuration");
63
+ try {
64
+ let n = await s(new URL(e.issuer), e.clientId, e.clientSecret, u(e.clientSecret)), r = n.serverMetadata().pushed_authorization_request_endpoint;
65
+ if (e.usePar) {
66
+ if (!r) throw Error("PAR requested (usePar=true) but provider does not advertise pushed_authorization_request_endpoint");
67
+ return g(n, t);
68
+ }
69
+ return r && d.info({ issuer: e.issuer }, "Provider advertises PAR but usePar is not enabled — set OAuthConfig.usePar=true to use it"), h(n, t);
57
70
  } catch (t) {
58
- throw u.error({
71
+ throw d.error({
59
72
  error: t,
60
73
  issuer: e.issuer
61
74
  }, "Failed to discover config or build URL"), t;
62
75
  }
63
76
  }
64
- async function g(e, t, r, i) {
65
- u.debug({
77
+ async function v(e, t, n, r) {
78
+ d.debug({
66
79
  issuer: e.issuer,
67
80
  clientId: e.clientId
68
81
  }, "Exchanging authorization code for tokens");
69
- let o = await a(await n(new URL(e.issuer), e.clientId, e.clientSecret, l(e.clientSecret)), t, {
70
- pkceCodeVerifier: r,
71
- expectedState: i
82
+ let i = await o(await s(new URL(e.issuer), e.clientId, e.clientSecret, u(e.clientSecret)), t, {
83
+ pkceCodeVerifier: n,
84
+ expectedState: r
72
85
  }, { redirect_uri: e.redirect_uri });
73
- return u.info({
74
- hasAccessToken: !!o.access_token,
75
- hasRefreshToken: !!o.refresh_token,
76
- expiresIn: o.expires_in
77
- }, "Authorization code exchange successful"), o;
86
+ return d.info({
87
+ hasAccessToken: !!i.access_token,
88
+ hasRefreshToken: !!i.refresh_token,
89
+ expiresIn: i.expires_in
90
+ }, "Authorization code exchange successful"), i;
78
91
  }
79
- function _(e, n = "roles") {
92
+ function y(e, n = "roles") {
80
93
  if (!e.id_token) throw Error("OIDC token response is missing id_token");
81
94
  let r = t(e.id_token), i = r[n], a = typeof i == "string" ? [i] : [], o = Array.isArray(i) ? i : a;
82
- return u.debug({
95
+ return d.debug({
83
96
  sub: r.sub,
84
97
  rolesClaim: n,
85
98
  rolesCount: o.length
@@ -90,9 +103,9 @@ function _(e, n = "roles") {
90
103
  roles: o
91
104
  };
92
105
  }
93
- function v(e, t = "roles") {
106
+ function b(e, t = "roles") {
94
107
  if (!e.access_token) throw Error("OIDC token response is missing access_token");
95
- let n = _(e, t);
108
+ let n = y(e, t);
96
109
  return {
97
110
  tokens: {
98
111
  accessToken: e.access_token,
@@ -106,34 +119,34 @@ function v(e, t = "roles") {
106
119
  }
107
120
  };
108
121
  }
109
- function y(e, t, n = "/", r) {
122
+ function x(e, t, n = "/", r) {
110
123
  let i = e ?? n, a;
111
124
  try {
112
125
  a = new URL(i, t);
113
126
  } catch {
114
- return u.warn({ returnTo: i }, "Invalid returnTo URL, using default"), new URL(n, t);
127
+ return d.warn({ returnTo: i }, "Invalid returnTo URL, using default"), new URL(n, t);
115
128
  }
116
129
  let o = new URL(t);
117
- return a.origin === o.origin ? r && !r(a.pathname) ? (u.warn({ pathname: a.pathname }, "returnTo failed custom validation, falling back to default"), new URL(n, t)) : a : (u.error({
130
+ return a.origin === o.origin ? r && !r(a.pathname) ? (d.warn({ pathname: a.pathname }, "returnTo failed custom validation, falling back to default"), new URL(n, t)) : a : (d.error({
118
131
  returnTo: i,
119
132
  redirectOrigin: a.origin,
120
133
  applicationOrigin: o.origin
121
134
  }, "Possible open redirect attack: returnTo points outside application origin"), new URL(n, t));
122
135
  }
123
- async function b(e, t) {
136
+ async function S(e, t) {
124
137
  try {
125
- let r = (await n(new URL(e.issuer), e.clientId, e.clientSecret, l(e.clientSecret))).serverMetadata().end_session_endpoint;
126
- if (!r) return u.info({ issuer: e.issuer }, "No end_session_endpoint found"), null;
127
- let i = new URL(r);
128
- return i.searchParams.set("client_id", e.clientId), i.searchParams.set("post_logout_redirect_uri", t), u.debug({ logoutUrl: i.toString() }, "Built OIDC logout URL"), i;
138
+ let n = (await s(new URL(e.issuer), e.clientId, e.clientSecret, u(e.clientSecret))).serverMetadata().end_session_endpoint;
139
+ if (!n) return d.info({ issuer: e.issuer }, "No end_session_endpoint found"), null;
140
+ let r = new URL(n);
141
+ return r.searchParams.set("client_id", e.clientId), r.searchParams.set("post_logout_redirect_uri", t), d.debug({ logoutUrl: r.toString() }, "Built OIDC logout URL"), r;
129
142
  } catch (t) {
130
- return u.warn({
143
+ return d.warn({
131
144
  error: t,
132
145
  issuer: e.issuer
133
146
  }, "OIDC discovery failed for logout"), null;
134
147
  }
135
148
  }
136
- async function x(e) {
149
+ async function C(e) {
137
150
  try {
138
151
  let t = new URLSearchParams({
139
152
  grant_type: "client_credentials",
@@ -148,18 +161,18 @@ async function x(e) {
148
161
  });
149
162
  if (!n.ok) {
150
163
  let e = await n.text();
151
- throw u.error({
164
+ throw d.error({
152
165
  status: n.status,
153
166
  error: e
154
167
  }, "Client credentials grant failed"), Error(`Client credentials grant failed: ${n.status} - ${e}`);
155
168
  }
156
169
  return await n.json();
157
170
  } catch (t) {
158
- throw u.error({
171
+ throw d.error({
159
172
  error: t,
160
173
  tokenEndpoint: e.tokenEndpoint
161
174
  }, "Client credentials grant error"), t;
162
175
  }
163
176
  }
164
177
  //#endregion
165
- export { m as buildAuthorizationUrl, b as buildOidcLogoutUrl, p as buildPKCEOptions, v as buildSessionFromTokens, x as clientCredentialsGrant, d as defaultScope, h as discoverAndBuildAuthorizationUrl, g as exchangeAuthorizationCode, _ as extractUserFromTokens, f as refreshAccessToken, y as validateReturnUrl };
178
+ export { h as buildAuthorizationUrl, g as buildAuthorizationUrlWithPAR, S as buildOidcLogoutUrl, m as buildPKCEOptions, b as buildSessionFromTokens, C as clientCredentialsGrant, f as defaultScope, _ as discoverAndBuildAuthorizationUrl, v as exchangeAuthorizationCode, y as extractUserFromTokens, p as refreshAccessToken, x as validateReturnUrl };
@@ -1,5 +1,5 @@
1
1
  import { createLogger as e } from "../../logger.js";
2
- import { a as t, c as n, n as r, t as i } from "../../build-BnXr85C9.js";
2
+ import { l as t, n, o as r, t as i } from "../../build-nL2--iMi.js";
3
3
  import { buildAuthorizationUrl as a, buildPKCEOptions as o } from "../../oauth.js";
4
4
  //#region src/providers/vipps/types.ts
5
5
  var s = {
@@ -48,7 +48,7 @@ var d = e({
48
48
  }, "VippsLoginClient initialized");
49
49
  }
50
50
  async getConfig() {
51
- return this.configPromise ||= t(new URL(this.oauthConfig.issuer), this.oauthConfig.clientId, this.oauthConfig.clientSecret, i(this.oauthConfig.clientSecret)), this.configPromise;
51
+ return this.configPromise ||= r(new URL(this.oauthConfig.issuer), this.oauthConfig.clientId, this.oauthConfig.clientSecret, i(this.oauthConfig.clientSecret)), this.configPromise;
52
52
  }
53
53
  async buildPKCEOptions() {
54
54
  return d.debug("Building PKCE options"), o(this.oauthConfig);
@@ -56,12 +56,12 @@ var d = e({
56
56
  async buildAuthorizationUrl(e) {
57
57
  return d.debug("Building authorization URL"), a(await this.getConfig(), e);
58
58
  }
59
- async exchangeCodeForTokens(e, t, n) {
59
+ async exchangeCodeForTokens(e, t, r) {
60
60
  d.debug("Exchanging authorization code for tokens");
61
61
  try {
62
- let i = await r(await this.getConfig(), typeof e == "string" ? new URL(e) : e, {
62
+ let i = await n(await this.getConfig(), typeof e == "string" ? new URL(e) : e, {
63
63
  pkceCodeVerifier: t,
64
- expectedState: n,
64
+ expectedState: r,
65
65
  idTokenExpected: !0
66
66
  });
67
67
  return d.info({
@@ -105,12 +105,12 @@ var d = e({
105
105
  async refreshTokens(e) {
106
106
  d.debug("Refreshing access token");
107
107
  try {
108
- let t = await n(await this.getConfig(), e);
108
+ let n = await t(await this.getConfig(), e);
109
109
  return d.info({
110
- hasAccessToken: !!t.access_token,
111
- hasRefreshToken: !!t.refresh_token,
112
- expiresIn: t.expires_in
113
- }, "Successfully refreshed tokens"), t;
110
+ hasAccessToken: !!n.access_token,
111
+ hasRefreshToken: !!n.refresh_token,
112
+ expiresIn: n.expires_in
113
+ }, "Successfully refreshed tokens"), n;
114
114
  } catch (e) {
115
115
  throw d.error({ error: e }, "Failed to refresh tokens"), e;
116
116
  }
@@ -1,5 +1,5 @@
1
1
  import { createLogger as e } from "./logger.js";
2
- import { a as t, r as n, t as r } from "./build-BnXr85C9.js";
2
+ import { o as t, r as n, t as r } from "./build-nL2--iMi.js";
3
3
  //#region src/silent-login.ts
4
4
  var i = e({ namespace: "fides-auth:silent-login" });
5
5
  async function a(e, a = {}) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eventuras/fides-auth",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "description": "Framework-agnostic OAuth/OIDC authentication library with PKCE, session management, and pluggable logging",
5
5
  "keywords": [
6
6
  "oauth",