@phila/sso-nuxt 0.0.7 → 0.0.8
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/module.d.ts
CHANGED
package/dist/module.js
CHANGED
|
@@ -13,7 +13,8 @@ const module$1 = defineNuxtModule({
|
|
|
13
13
|
globalAuth: true,
|
|
14
14
|
loginPath: "/login",
|
|
15
15
|
excludePaths: ["/logout"],
|
|
16
|
-
signInPolicy: "
|
|
16
|
+
signInPolicy: "B2C_1A_SIGNUP_SIGNIN",
|
|
17
|
+
signInOnlyPolicy: "B2C_1A_AD_SIGNIN_ONLY",
|
|
17
18
|
resetPasswordPolicy: "B2C_1A_PASSWORDRESET"
|
|
18
19
|
},
|
|
19
20
|
async setup(options, nuxt) {
|
|
@@ -32,6 +33,7 @@ const module$1 = defineNuxtModule({
|
|
|
32
33
|
ssoAuthorityDomain: "PhilaB2CDev.b2clogin.com",
|
|
33
34
|
ssoApiScope: "",
|
|
34
35
|
ssoSignInPolicy: options.signInPolicy,
|
|
36
|
+
ssoSignInOnlyPolicy: options.signInOnlyPolicy,
|
|
35
37
|
ssoResetPasswordPolicy: options.resetPasswordPolicy,
|
|
36
38
|
ssoLoginPath: options.loginPath,
|
|
37
39
|
ssoExcludePaths: options.excludePaths
|
package/dist/module.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.js","sources":["../src/module.ts"],"sourcesContent":["// ABOUTME: Nuxt module that wires up phila-identity SSO with zero app boilerplate\n// ABOUTME: Installs pinia, registers the client plugin, auto-imports useAuth, and optionally guards routes\n\nimport {\n defineNuxtModule,\n addPlugin,\n addImports,\n addRouteMiddleware,\n installModule,\n createResolver,\n extendViteConfig,\n} from \"@nuxt/kit\";\nimport { fileURLToPath } from \"node:url\";\nimport { dirname, resolve } from \"node:path\";\nimport { defu } from \"defu\";\n\nconst __dirname = dirname(fileURLToPath(import.meta.url));\n// packages/sso-nuxt/src → packages/sso-nuxt → packages → phila-identity\nconst philaIdentityRoot = resolve(__dirname, \"../../..\");\n\nexport interface ModuleOptions {\n globalAuth?: boolean;\n loginPath?: string;\n excludePaths?: string[];\n signInPolicy?: string;\n resetPasswordPolicy?: string;\n}\n\nexport default defineNuxtModule<ModuleOptions>({\n meta: {\n name: \"@phila/sso-nuxt\",\n configKey: \"sso\",\n },\n defaults: {\n globalAuth: true,\n loginPath: \"/login\",\n excludePaths: [\"/logout\"],\n signInPolicy: \"B2C_1A_AD_SIGNIN_ONLY\",\n resetPasswordPolicy: \"B2C_1A_PASSWORDRESET\",\n },\n async setup(options, nuxt) {\n const resolver = createResolver(import.meta.url);\n\n // 1. Install @pinia/nuxt so apps don't need to list it explicitly\n await installModule(\"@pinia/nuxt\");\n\n // 2. Transpile local file: linked packages so Vite/SSR can process them\n nuxt.options.build.transpile.push(\"@phila/sso-core\", \"@phila/sso-vue\");\n\n // 3. Allow Vite dev server to serve files from phila-identity source tree\n extendViteConfig(config => {\n config.server = config.server ?? {};\n config.server.fs = config.server.fs ?? {};\n config.server.fs.allow = [...(config.server.fs.allow ?? []), philaIdentityRoot];\n });\n\n // 4 & 5. Declare SSO keys in runtimeConfig.public (env vars override at runtime)\n nuxt.options.runtimeConfig.public = defu(nuxt.options.runtimeConfig.public, {\n ssoClientId: \"\",\n ssoRedirectUri: \"http://localhost:3000\",\n ssoTenant: \"PhilaB2CDev\",\n ssoAuthorityDomain: \"PhilaB2CDev.b2clogin.com\",\n ssoApiScope: \"\",\n ssoSignInPolicy: options.signInPolicy,\n ssoResetPasswordPolicy: options.resetPasswordPolicy,\n ssoLoginPath: options.loginPath,\n ssoExcludePaths: options.excludePaths,\n });\n\n // 6. Register client-only plugin that initialises the B2C auth client\n addPlugin({ src: resolver.resolve(\"./runtime/plugin.client\"), mode: \"client\" });\n\n // 7. Auto-import useAuth so components don't need an explicit import\n addImports({ name: \"useAuth\", as: \"useAuth\", from: \"@phila/sso-vue\" });\n addImports({ name: \"useSSOStore\", as: \"useSSOStore\", from: \"@phila/sso-vue\" });\n\n // 8. Optionally register global route guard\n if (options.globalAuth) {\n addRouteMiddleware({\n name: \"auth\",\n path: resolver.resolve(\"./runtime/middleware.auth\"),\n global: true,\n });\n }\n },\n});\n"],"names":["__dirname"],"mappings":";;;;AAgBA,MAAMA,cAAY,QAAQ,cAAc,YAAY,GAAG,CAAC;AAExD,MAAM,oBAAoB,QAAQA,aAAW,UAAU;
|
|
1
|
+
{"version":3,"file":"module.js","sources":["../src/module.ts"],"sourcesContent":["// ABOUTME: Nuxt module that wires up phila-identity SSO with zero app boilerplate\n// ABOUTME: Installs pinia, registers the client plugin, auto-imports useAuth, and optionally guards routes\n\nimport {\n defineNuxtModule,\n addPlugin,\n addImports,\n addRouteMiddleware,\n installModule,\n createResolver,\n extendViteConfig,\n} from \"@nuxt/kit\";\nimport { fileURLToPath } from \"node:url\";\nimport { dirname, resolve } from \"node:path\";\nimport { defu } from \"defu\";\n\nconst __dirname = dirname(fileURLToPath(import.meta.url));\n// packages/sso-nuxt/src → packages/sso-nuxt → packages → phila-identity\nconst philaIdentityRoot = resolve(__dirname, \"../../..\");\n\nexport interface ModuleOptions {\n globalAuth?: boolean;\n loginPath?: string;\n excludePaths?: string[];\n signInPolicy?: string;\n signInOnlyPolicy?: string;\n resetPasswordPolicy?: string;\n}\n\nexport default defineNuxtModule<ModuleOptions>({\n meta: {\n name: \"@phila/sso-nuxt\",\n configKey: \"sso\",\n },\n defaults: {\n globalAuth: true,\n loginPath: \"/login\",\n excludePaths: [\"/logout\"],\n signInPolicy: \"B2C_1A_SIGNUP_SIGNIN\",\n signInOnlyPolicy: \"B2C_1A_AD_SIGNIN_ONLY\",\n resetPasswordPolicy: \"B2C_1A_PASSWORDRESET\",\n },\n async setup(options, nuxt) {\n const resolver = createResolver(import.meta.url);\n\n // 1. Install @pinia/nuxt so apps don't need to list it explicitly\n await installModule(\"@pinia/nuxt\");\n\n // 2. Transpile local file: linked packages so Vite/SSR can process them\n nuxt.options.build.transpile.push(\"@phila/sso-core\", \"@phila/sso-vue\");\n\n // 3. Allow Vite dev server to serve files from phila-identity source tree\n extendViteConfig(config => {\n config.server = config.server ?? {};\n config.server.fs = config.server.fs ?? {};\n config.server.fs.allow = [...(config.server.fs.allow ?? []), philaIdentityRoot];\n });\n\n // 4 & 5. Declare SSO keys in runtimeConfig.public (env vars override at runtime)\n nuxt.options.runtimeConfig.public = defu(nuxt.options.runtimeConfig.public, {\n ssoClientId: \"\",\n ssoRedirectUri: \"http://localhost:3000\",\n ssoTenant: \"PhilaB2CDev\",\n ssoAuthorityDomain: \"PhilaB2CDev.b2clogin.com\",\n ssoApiScope: \"\",\n ssoSignInPolicy: options.signInPolicy,\n ssoSignInOnlyPolicy: options.signInOnlyPolicy,\n ssoResetPasswordPolicy: options.resetPasswordPolicy,\n ssoLoginPath: options.loginPath,\n ssoExcludePaths: options.excludePaths,\n });\n\n // 6. Register client-only plugin that initialises the B2C auth client\n addPlugin({ src: resolver.resolve(\"./runtime/plugin.client\"), mode: \"client\" });\n\n // 7. Auto-import useAuth so components don't need an explicit import\n addImports({ name: \"useAuth\", as: \"useAuth\", from: \"@phila/sso-vue\" });\n addImports({ name: \"useSSOStore\", as: \"useSSOStore\", from: \"@phila/sso-vue\" });\n\n // 8. Optionally register global route guard\n if (options.globalAuth) {\n addRouteMiddleware({\n name: \"auth\",\n path: resolver.resolve(\"./runtime/middleware.auth\"),\n global: true,\n });\n }\n },\n});\n"],"names":["__dirname"],"mappings":";;;;AAgBA,MAAMA,cAAY,QAAQ,cAAc,YAAY,GAAG,CAAC;AAExD,MAAM,oBAAoB,QAAQA,aAAW,UAAU;AAWvD,MAAA,WAAe,iBAAgC;AAAA,EAC7C,MAAM;AAAA,IACJ,MAAM;AAAA,IACN,WAAW;AAAA,EAAA;AAAA,EAEb,UAAU;AAAA,IACR,YAAY;AAAA,IACZ,WAAW;AAAA,IACX,cAAc,CAAC,SAAS;AAAA,IACxB,cAAc;AAAA,IACd,kBAAkB;AAAA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signInOnly: config.ssoSignInOnlyPolicy,
|
|
19
19
|
resetPassword: config.ssoResetPasswordPolicy
|
|
20
20
|
}
|
|
21
21
|
}),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.client.js","sources":["../../src/runtime/plugin.client.ts"],"sourcesContent":["// ABOUTME: Client-only Nuxt plugin registered by @phila/sso-nuxt module\n// ABOUTME: Initializes Azure AD B2C authentication on the Nuxt app instance\nimport { defineNuxtPlugin, useRuntimeConfig } from \"nuxt/app\";\nimport { createSSOPlugin } from \"@phila/sso-vue\";\nimport { B2CProvider } from \"@phila/sso-core\";\n\nexport default defineNuxtPlugin(nuxtApp => {\n const config = useRuntimeConfig().public;\n const apiScope = (config.ssoApiScope as string) || \"\";\n const apiScopes = apiScope ? apiScope.split(\",\").map(s => s.trim()) : [];\n\n const plugin = createSSOPlugin({\n clientConfig: {\n provider: new B2CProvider({\n clientId: config.ssoClientId as string,\n b2cEnvironment: config.ssoTenant as string,\n authorityDomain: config.ssoAuthorityDomain as string,\n redirectUri: config.ssoRedirectUri as string,\n apiScopes,\n policies: {\n signUpSignIn: config.ssoSignInPolicy as string,\n signInOnly: config.
|
|
1
|
+
{"version":3,"file":"plugin.client.js","sources":["../../src/runtime/plugin.client.ts"],"sourcesContent":["// ABOUTME: Client-only Nuxt plugin registered by @phila/sso-nuxt module\n// ABOUTME: Initializes Azure AD B2C authentication on the Nuxt app instance\nimport { defineNuxtPlugin, useRuntimeConfig } from \"nuxt/app\";\nimport { createSSOPlugin } from \"@phila/sso-vue\";\nimport { B2CProvider } from \"@phila/sso-core\";\n\nexport default defineNuxtPlugin(nuxtApp => {\n const config = useRuntimeConfig().public;\n const apiScope = (config.ssoApiScope as string) || \"\";\n const apiScopes = apiScope ? apiScope.split(\",\").map(s => s.trim()) : [];\n\n const plugin = createSSOPlugin({\n clientConfig: {\n provider: new B2CProvider({\n clientId: config.ssoClientId as string,\n b2cEnvironment: config.ssoTenant as string,\n authorityDomain: config.ssoAuthorityDomain as string,\n redirectUri: config.ssoRedirectUri as string,\n apiScopes,\n policies: {\n signUpSignIn: config.ssoSignInPolicy as string,\n signInOnly: config.ssoSignInOnlyPolicy as string,\n resetPassword: config.ssoResetPasswordPolicy as string,\n },\n }),\n debug: import.meta.dev,\n },\n });\n nuxtApp.vueApp.use(plugin);\n});\n"],"names":[],"mappings":";;;AAMA,MAAA,gBAAe,iBAAiB,CAAA,YAAW;AACzC,QAAM,SAAS,mBAAmB;AAClC,QAAM,WAAY,OAAO,eAA0B;AACnD,QAAM,YAAY,WAAW,SAAS,MAAM,GAAG,EAAE,IAAI,CAAA,MAAK,EAAE,KAAA,CAAM,IAAI,CAAA;AAEtE,QAAM,SAAS,gBAAgB;AAAA,IAC7B,cAAc;AAAA,MACZ,UAAU,IAAI,YAAY;AAAA,QACxB,UAAU,OAAO;AAAA,QACjB,gBAAgB,OAAO;AAAA,QACvB,iBAAiB,OAAO;AAAA,QACxB,aAAa,OAAO;AAAA,QACpB;AAAA,QACA,UAAU;AAAA,UACR,cAAc,OAAO;AAAA,UACrB,YAAY,OAAO;AAAA,UACnB,eAAe,OAAO;AAAA,QAAA;AAAA,MACxB,CACD;AAAA,MACD,OAAO,YAAY;AAAA,IAAA;AAAA,EACrB,CACD;AACD,UAAQ,OAAO,IAAI,MAAM;AAC3B,CAAC;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@phila/sso-nuxt",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.8",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"@nuxt/kit": "^3.0.0",
|
|
20
20
|
"defu": "^6.0.0",
|
|
21
|
-
"@phila/sso-core": "0.0.
|
|
22
|
-
"@phila/sso-vue": "0.0.
|
|
21
|
+
"@phila/sso-core": "0.0.8",
|
|
22
|
+
"@phila/sso-vue": "0.0.8"
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
25
25
|
"nuxt": "^3.0.0"
|