@openape/nuxt-auth-sp 0.4.1 → 0.5.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.
package/README.md CHANGED
@@ -14,7 +14,7 @@ export default defineNuxtConfig({
14
14
  modules: ['@openape/nuxt-auth-sp'],
15
15
 
16
16
  openapeSp: {
17
- spId: 'sp.example.com',
17
+ clientId: 'sp.example.com',
18
18
  spName: 'My Service',
19
19
  sessionSecret: 'your-secret-min-32-chars...',
20
20
  },
@@ -25,7 +25,7 @@ export default defineNuxtConfig({
25
25
 
26
26
  | Option | Type | Default | Description |
27
27
  |--------|------|---------|-------------|
28
- | `spId` | `string` | — | **Required.** Service Provider identifier (typically your domain) |
28
+ | `clientId` | `string` | — | **Required.** Service Provider identifier (typically your domain) |
29
29
  | `spName` | `string` | `'OpenApe Service Provider'` | Display name shown during authorization |
30
30
  | `sessionSecret` | `string` | `'change-me-sp-secret-...'` | Session encryption key |
31
31
  | `openapeUrl` | `string` | — | Override IdP URL (bypasses DNS discovery) |
@@ -89,7 +89,7 @@ export default defineNuxtConfig({
89
89
  modules: ['@openape/nuxt-auth-sp'],
90
90
 
91
91
  openapeSp: {
92
- spId: 'localhost:3001',
92
+ clientId: 'localhost:3001',
93
93
  spName: 'My App',
94
94
  sessionSecret: 'at-least-32-characters-long-secret-here',
95
95
  },
package/dist/module.d.mts CHANGED
@@ -45,7 +45,7 @@ interface ManifestConfig {
45
45
  };
46
46
  }
47
47
  interface ModuleOptions {
48
- spId: string;
48
+ clientId: string;
49
49
  spName: string;
50
50
  sessionSecret: string;
51
51
  openapeUrl: string;
package/dist/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@openape/nuxt-auth-sp",
3
3
  "configKey": "openapeSp",
4
- "version": "0.4.1",
4
+ "version": "0.5.1",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "unknown"
package/dist/module.mjs CHANGED
@@ -9,7 +9,7 @@ const module$1 = defineNuxtModule({
9
9
  configKey: "openapeSp"
10
10
  },
11
11
  defaults: {
12
- spId: "",
12
+ clientId: "",
13
13
  spName: "OpenApe Service Provider",
14
14
  sessionSecret: "change-me-sp-secret-at-least-32-chars-long",
15
15
  openapeUrl: "",
@@ -29,10 +29,10 @@ const module$1 = defineNuxtModule({
29
29
  config.sessionSecret = crypto.randomUUID() + crypto.randomUUID();
30
30
  logger.info("Auto-generated sessionSecret for dev mode");
31
31
  }
32
- if (!config.spId) {
32
+ if (!config.clientId) {
33
33
  const port = nuxt.options.devServer?.port || 3e3;
34
- config.spId = `localhost:${port}`;
35
- logger.info(`Auto-derived spId: ${config.spId}`);
34
+ config.clientId = `localhost:${port}`;
35
+ logger.info(`Auto-derived clientId: ${config.clientId}`);
36
36
  }
37
37
  }
38
38
  if (!nuxt.options.dev) {
@@ -40,8 +40,8 @@ const module$1 = defineNuxtModule({
40
40
  if (config.sessionSecret === "change-me-sp-secret-at-least-32-chars-long") {
41
41
  logger.warn("Using default sessionSecret in production! Set NUXT_OPENAPE_SP_SESSION_SECRET.");
42
42
  }
43
- if (!config.spId) {
44
- logger.warn("spId is empty in production! Set openapeSp.spId or NUXT_OPENAPE_SP_SP_ID.");
43
+ if (!config.clientId) {
44
+ logger.warn("clientId is empty in production! Set openapeSp.clientId or NUXT_OPENAPE_SP_CLIENT_ID.");
45
45
  }
46
46
  }
47
47
  addServerImportsDir(resolve("./runtime/server/utils"));
@@ -5,7 +5,7 @@ import { getSpSession } from "../utils/sp-session.js";
5
5
  export default defineEventHandler(async (event) => {
6
6
  const query = getQuery(event);
7
7
  const { code, state, error, error_description } = query;
8
- const { spId } = getSpConfig();
8
+ const { clientId } = getSpConfig();
9
9
  const origin = getRequestURL(event).origin;
10
10
  const redirectUri = `${origin}/api/callback`;
11
11
  if (error) {
@@ -24,7 +24,7 @@ export default defineEventHandler(async (event) => {
24
24
  code,
25
25
  state,
26
26
  flowState,
27
- spId,
27
+ clientId,
28
28
  redirectUri
29
29
  });
30
30
  clearFlowState(event);
@@ -3,7 +3,7 @@ import { createAuthorizationURL, discoverIdP } from "@openape/auth";
3
3
  import { getSpConfig, saveFlowState } from "../utils/sp-config.js";
4
4
  export default defineEventHandler(async (event) => {
5
5
  const body = await readBody(event);
6
- const { spId, openapeUrl, fallbackIdpUrl } = getSpConfig();
6
+ const { clientId, openapeUrl, fallbackIdpUrl } = getSpConfig();
7
7
  const origin = getRequestURL(event).origin;
8
8
  const redirectUri = `${origin}/api/callback`;
9
9
  if (!body?.email || !body.email.includes("@")) {
@@ -24,7 +24,7 @@ export default defineEventHandler(async (event) => {
24
24
  });
25
25
  }
26
26
  const { url, flowState } = await createAuthorizationURL(idpConfig, {
27
- spId,
27
+ clientId,
28
28
  redirectUri,
29
29
  email
30
30
  });
@@ -1,21 +0,0 @@
1
- import type { H3Event } from 'h3';
2
- import type { DDISAAssertionClaims } from '@openape/core';
3
- export interface LoginHandlerOptions {
4
- callbackPath: string;
5
- }
6
- export interface CallbackHandlerOptions {
7
- onSuccess: (event: H3Event, result: {
8
- claims: DDISAAssertionClaims;
9
- rawAssertion: string;
10
- }) => Promise<void>;
11
- onError?: (event: H3Event, error: Error) => Promise<void>;
12
- }
13
- export interface SPManifestHandlerOptions {
14
- callbackPath: string;
15
- description?: string;
16
- }
17
- export declare function defineOpenApeLoginHandler(options: LoginHandlerOptions): import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<{
18
- redirectUrl: string;
19
- }>>;
20
- export declare function defineOpenApeCallbackHandler(options: CallbackHandlerOptions): import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<void>>;
21
- export declare function defineOpenApeSPManifestHandler(options: SPManifestHandlerOptions): import("h3").EventHandler<import("h3").EventHandlerRequest, import("@openape/core").SPManifest>;
@@ -4,7 +4,7 @@ import { getSpConfig, saveFlowState, getFlowState, clearFlowState } from "./util
4
4
  export function defineOpenApeLoginHandler(options) {
5
5
  return defineEventHandler(async (event) => {
6
6
  const body = await readBody(event);
7
- const { spId, openapeUrl, fallbackIdpUrl } = getSpConfig();
7
+ const { clientId, openapeUrl, fallbackIdpUrl } = getSpConfig();
8
8
  const origin = getRequestURL(event).origin;
9
9
  const redirectUri = `${origin}${options.callbackPath}`;
10
10
  if (!body?.email || !body.email.includes("@")) {
@@ -25,7 +25,7 @@ export function defineOpenApeLoginHandler(options) {
25
25
  });
26
26
  }
27
27
  const { url, flowState } = await createAuthorizationURL(idpConfig, {
28
- spId,
28
+ clientId,
29
29
  redirectUri,
30
30
  email
31
31
  });
@@ -37,7 +37,7 @@ export function defineOpenApeCallbackHandler(options) {
37
37
  return defineEventHandler(async (event) => {
38
38
  const query = getQuery(event);
39
39
  const { code, state, error, error_description } = query;
40
- const { spId } = getSpConfig();
40
+ const { clientId } = getSpConfig();
41
41
  const origin = getRequestURL(event).origin;
42
42
  if (error) {
43
43
  const msg = error_description || error;
@@ -70,7 +70,7 @@ export function defineOpenApeCallbackHandler(options) {
70
70
  code,
71
71
  state,
72
72
  flowState,
73
- spId,
73
+ clientId,
74
74
  redirectUri
75
75
  });
76
76
  await clearFlowState(event);
@@ -88,10 +88,10 @@ export function defineOpenApeCallbackHandler(options) {
88
88
  }
89
89
  export function defineOpenApeSPManifestHandler(options) {
90
90
  return defineEventHandler((event) => {
91
- const { spId, spName } = getSpConfig();
91
+ const { clientId, spName } = getSpConfig();
92
92
  const origin = getRequestURL(event).origin;
93
93
  return createSPManifest({
94
- sp_id: spId,
94
+ client_id: clientId,
95
95
  name: spName,
96
96
  redirect_uris: [`${origin}${options.callbackPath}`],
97
97
  description: options.description || `${spName} \u2014 OpenApe Service Provider`
@@ -1,7 +1,7 @@
1
1
  import { defineEventHandler, getRequestURL, setResponseHeader } from "h3";
2
2
  import { getSpConfig } from "../../utils/sp-config.js";
3
3
  export default defineEventHandler((event) => {
4
- const { spId, spName, fallbackIdpUrl } = getSpConfig();
4
+ const { clientId, spName, fallbackIdpUrl } = getSpConfig();
5
5
  const origin = getRequestURL(event).origin;
6
6
  setResponseHeader(event, "Content-Type", "text/markdown; charset=utf-8");
7
7
  return `# Authentication \u2014 ${spName}
@@ -10,7 +10,7 @@ export default defineEventHandler((event) => {
10
10
  DDISA v1 (DNS-Discoverable Identity & Service Authorization)
11
11
 
12
12
  ## Service Provider
13
- - **SP ID:** \`${spId}\`
13
+ - **SP ID:** \`${clientId}\`
14
14
  - **Origin:** \`${origin}\`
15
15
 
16
16
  ## Endpoints
@@ -3,7 +3,7 @@ import { useRuntimeConfig } from "nitropack/runtime";
3
3
  import { getSpConfig } from "../../utils/sp-config.js";
4
4
  export default defineEventHandler((event) => {
5
5
  const config = useRuntimeConfig();
6
- const { spId, spName } = getSpConfig();
6
+ const { clientId, spName } = getSpConfig();
7
7
  const origin = getRequestURL(event).origin;
8
8
  const manifest = config.openapeSp.manifest;
9
9
  setResponseHeader(event, "Access-Control-Allow-Origin", "*");
@@ -16,7 +16,7 @@ export default defineEventHandler((event) => {
16
16
  ...manifest?.service || {}
17
17
  },
18
18
  auth: {
19
- ddisa_domain: spId,
19
+ ddisa_domain: clientId,
20
20
  supported_methods: ["ddisa"],
21
21
  ...manifest?.auth || {}
22
22
  },
@@ -1,2 +0,0 @@
1
- declare const _default: import("h3").EventHandler<import("h3").EventHandlerRequest, import("@openape/core").SPManifest>;
2
- export default _default;
@@ -2,10 +2,10 @@ import { defineEventHandler, getRequestURL } from "h3";
2
2
  import { createSPManifest } from "@openape/auth";
3
3
  import { getSpConfig } from "../../utils/sp-config.js";
4
4
  export default defineEventHandler((event) => {
5
- const { spId, spName } = getSpConfig();
5
+ const { clientId, spName } = getSpConfig();
6
6
  const origin = getRequestURL(event).origin;
7
7
  return createSPManifest({
8
- sp_id: spId,
8
+ client_id: clientId,
9
9
  name: spName,
10
10
  redirect_uris: [`${origin}/api/callback`],
11
11
  description: `${spName} \u2014 OpenApe Service Provider`
@@ -1,7 +1,7 @@
1
1
  import type { H3Event } from 'h3';
2
2
  import type { AuthFlowState } from '@openape/core';
3
3
  export declare function getSpConfig(): {
4
- spId: any;
4
+ clientId: any;
5
5
  openapeUrl: any;
6
6
  spName: any;
7
7
  fallbackIdpUrl: any;
@@ -4,7 +4,7 @@ const FLOW_COOKIE = "openape-flow";
4
4
  export function getSpConfig() {
5
5
  const config = useRuntimeConfig();
6
6
  return {
7
- spId: (config.openapeSp.spId || "sp.example.com").trim(),
7
+ clientId: (config.openapeSp.clientId || "sp.example.com").trim(),
8
8
  openapeUrl: (config.openapeSp.openapeUrl || "").trim(),
9
9
  spName: (config.openapeSp.spName || "OpenApe Service Provider").trim(),
10
10
  fallbackIdpUrl: (config.openapeSp.fallbackIdpUrl || "https://id.openape.at").trim()
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@openape/nuxt-auth-sp",
3
3
  "type": "module",
4
- "version": "0.4.1",
4
+ "version": "0.5.1",
5
5
  "description": "OpenAPE Service Provider Nuxt module — adds OIDC login via DNS-based IdP discovery",
6
6
  "author": "Delta Mind GmbH",
7
7
  "license": "AGPL-3.0-or-later",
@@ -33,8 +33,8 @@
33
33
  },
34
34
  "dependencies": {
35
35
  "@nuxt/kit": "^3.21.1",
36
- "@openape/auth": "^0.2.0",
37
- "@openape/core": "^0.2.0",
36
+ "@openape/auth": "^0.3.0",
37
+ "@openape/core": "^0.3.0",
38
38
  "defu": "^6.1.4"
39
39
  },
40
40
  "peerDependencies": {