@svadmin/sso 0.11.18 → 0.11.20

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/presets.d.ts CHANGED
@@ -68,13 +68,15 @@ export declare function createKeycloakAuth(baseUrl: string, realm: string, clien
68
68
  export declare function createAuth0Auth(domain: string, clientId: string, opts?: PresetOptions): import("./auth-provider.js").SSOAuthProvider;
69
69
  export type { PresetOptions };
70
70
  /**
71
- * Supauth OIDC Sign-In (GoTrue-compatible identity provider).
71
+ * Supauth hosted OIDC Sign-In.
72
72
  *
73
- * Compatible with SupaCloud, SupaOAuth, and any GoTrue-based auth backend.
74
- * Uses standard OIDC Authorization Code Flow with PKCE.
73
+ * Targets the SupAuth contract hosted by SupaCloud or SupaOAuth: OIDC endpoints
74
+ * live below `/auth/v1`, while browser sign-out lives at the public root
75
+ * `/logout`. Other GoTrue deployments should provide explicit endpoints or use
76
+ * `createSSOAuthProvider()` directly.
75
77
  *
76
- * @param issuer - Supauth issuer URL (e.g., 'https://auth.example.com')
77
78
  * @param clientId - OAuth2 Client ID
79
+ * @param opts - SSO options. `opts.issuer` accepts a Supauth public root or `/auth/v1` issuer URL.
78
80
  */
79
81
  export declare function createSupauthAuth(clientId: string, opts?: PresetOptions & {
80
82
  issuer?: string;
package/dist/presets.js CHANGED
@@ -144,22 +144,43 @@ export function createAuth0Auth(domain, clientId, opts) {
144
144
  });
145
145
  }
146
146
  // ─── Supauth / GoTrue ────────────────────────────────────────
147
+ function normalizeSupauthIssuer(configuredIssuer) {
148
+ const normalizedIssuer = configuredIssuer.replace(/\/+$/, '');
149
+ if (!normalizedIssuer || normalizedIssuer.endsWith('/auth/v1')) {
150
+ return {
151
+ issuer: normalizedIssuer,
152
+ publicRoot: normalizedIssuer.slice(0, -'/auth/v1'.length),
153
+ };
154
+ }
155
+ return { issuer: `${normalizedIssuer}/auth/v1`, publicRoot: normalizedIssuer };
156
+ }
147
157
  /**
148
- * Supauth OIDC Sign-In (GoTrue-compatible identity provider).
158
+ * Supauth hosted OIDC Sign-In.
149
159
  *
150
- * Compatible with SupaCloud, SupaOAuth, and any GoTrue-based auth backend.
151
- * Uses standard OIDC Authorization Code Flow with PKCE.
160
+ * Targets the SupAuth contract hosted by SupaCloud or SupaOAuth: OIDC endpoints
161
+ * live below `/auth/v1`, while browser sign-out lives at the public root
162
+ * `/logout`. Other GoTrue deployments should provide explicit endpoints or use
163
+ * `createSSOAuthProvider()` directly.
152
164
  *
153
- * @param issuer - Supauth issuer URL (e.g., 'https://auth.example.com')
154
165
  * @param clientId - OAuth2 Client ID
166
+ * @param opts - SSO options. `opts.issuer` accepts a Supauth public root or `/auth/v1` issuer URL.
155
167
  */
156
168
  export function createSupauthAuth(clientId, opts) {
157
- const issuer = opts?.issuer ?? '';
169
+ const manualLogoutEndpoint = opts?.manualEndpoints?.end_session_endpoint;
170
+ const { issuer: configuredIssuer = '', endSessionEndpoint: configuredLogoutEndpoint, storageKey: configuredStorageKey, ...providerOptions } = opts ?? {};
171
+ const { issuer, publicRoot } = normalizeSupauthIssuer(configuredIssuer);
172
+ const storageKey = configuredStorageKey
173
+ ?? `svadmin_sso:${encodeURIComponent(configuredIssuer)}:${encodeURIComponent(clientId)}`;
174
+ const endSessionEndpoint = configuredLogoutEndpoint
175
+ ?? manualLogoutEndpoint
176
+ ?? (publicRoot ? `${publicRoot}/logout` : undefined);
158
177
  return createSSOAuthProvider({
159
178
  issuer,
160
179
  clientId,
161
180
  scopes: ['openid', 'profile', 'email'],
162
181
  redirectUri: resolveRedirectUri(opts),
163
- ...opts,
182
+ storageKey,
183
+ ...(endSessionEndpoint === undefined ? {} : { endSessionEndpoint }),
184
+ ...providerOptions,
164
185
  });
165
186
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@svadmin/sso",
3
- "version": "0.11.18",
3
+ "version": "0.11.20",
4
4
  "type": "module",
5
5
  "description": "OIDC/OAuth2 SSO AuthProvider plugin for svadmin — supports Okta, Azure AD, Cognito, Keycloak, Google",
6
6
  "license": "MIT",
@@ -34,7 +34,7 @@
34
34
  "dist"
35
35
  ],
36
36
  "peerDependencies": {
37
- "@svadmin/core": "^0.49.0"
37
+ "@svadmin/core": "^0.49.1"
38
38
  },
39
39
  "devDependencies": {
40
40
  "typescript": "^7.0.2"