@phila/sso-vue 0.0.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 City of Philadelphia
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,529 @@
1
+ import { AccountInfo } from '@azure/msal-browser';
2
+ import { App } from 'vue';
3
+ import { ComputedRef } from 'vue';
4
+ import { Ref } from 'vue';
5
+ import { SignInOptions } from '@phila/sso-core';
6
+ import { SignOutOptions } from '@phila/sso-core';
7
+ import { SSOClient } from '@phila/sso-core';
8
+ import { SSOClientConfig } from '@phila/sso-core';
9
+ import { SSOClientState } from '@phila/sso-core';
10
+ import { StoreDefinition } from 'pinia';
11
+ import { TenantProfile } from '@azure/msal-browser';
12
+ import { TokenOptions } from '@phila/sso-core';
13
+
14
+ export declare interface B2CPluginOptions {
15
+ signInPolicy?: string;
16
+ resetPasswordPolicy?: string;
17
+ debug?: boolean;
18
+ }
19
+
20
+ /**
21
+ * Creates a ready-to-use Vue plugin for Azure AD B2C authentication.
22
+ * Reads connection details from VITE_SSO_* environment variables:
23
+ * VITE_SSO_CLIENT_ID, VITE_SSO_TENANT, VITE_SSO_AUTHORITY_DOMAIN, VITE_SSO_REDIRECT_URI
24
+ */
25
+ export declare function createB2CPlugin(options?: B2CPluginOptions): {
26
+ install(app: App): void;
27
+ };
28
+
29
+ export declare function createSSOPlugin(options: SSOPluginOptions): {
30
+ install(app: App): void;
31
+ };
32
+
33
+ export declare const SSO_CLIENT_KEY: unique symbol;
34
+
35
+ export declare interface SSOPluginOptions {
36
+ clientConfig: SSOClientConfig;
37
+ autoInitialize?: boolean;
38
+ }
39
+
40
+ /**
41
+ * Primary composable for SSO authentication in Vue 3 apps.
42
+ * API shape is intentionally similar to service-cat's existing useAuth()
43
+ * to minimize migration friction.
44
+ */
45
+ export declare function useAuth(): {
46
+ isAuthenticated: Ref<boolean, boolean>;
47
+ isLoading: Ref<boolean, boolean>;
48
+ user: Ref< {
49
+ homeAccountId: string;
50
+ environment: string;
51
+ tenantId: string;
52
+ username: string;
53
+ localAccountId: string;
54
+ name?: string | undefined;
55
+ idToken?: string | undefined;
56
+ idTokenClaims?: {
57
+ [x: string]: unknown;
58
+ aud?: string | undefined;
59
+ iss?: string | undefined;
60
+ iat?: number | undefined;
61
+ nbf?: number | undefined;
62
+ oid?: string | undefined;
63
+ sub?: string | undefined;
64
+ tid?: string | undefined;
65
+ tfp?: string | undefined;
66
+ acr?: string | undefined;
67
+ ver?: string | undefined;
68
+ upn?: string | undefined;
69
+ preferred_username?: string | undefined;
70
+ login_hint?: string | undefined;
71
+ emails?: string[] | undefined;
72
+ name?: string | undefined;
73
+ nonce?: string | undefined;
74
+ exp?: number | undefined;
75
+ home_oid?: string | undefined;
76
+ sid?: string | undefined;
77
+ cloud_instance_host_name?: string | undefined;
78
+ cnf?: {
79
+ kid: string;
80
+ } | undefined;
81
+ x5c_ca?: string[] | undefined;
82
+ ts?: number | undefined;
83
+ at?: string | undefined;
84
+ u?: string | undefined;
85
+ p?: string | undefined;
86
+ m?: string | undefined;
87
+ roles?: string[] | undefined;
88
+ amr?: string[] | undefined;
89
+ idp?: string | undefined;
90
+ auth_time?: number | undefined;
91
+ tenant_region_scope?: string | undefined;
92
+ tenant_region_sub_scope?: string | undefined;
93
+ } | undefined;
94
+ nativeAccountId?: string | undefined;
95
+ authorityType?: string | undefined;
96
+ tenantProfiles?: (Map<string, {
97
+ tenantId: string;
98
+ localAccountId: string;
99
+ name?: string | undefined;
100
+ isHomeTenant?: boolean | undefined;
101
+ }> & Omit<Map<string, TenantProfile>, keyof Map<any, any>>) | undefined;
102
+ } | null, AccountInfo | {
103
+ homeAccountId: string;
104
+ environment: string;
105
+ tenantId: string;
106
+ username: string;
107
+ localAccountId: string;
108
+ name?: string | undefined;
109
+ idToken?: string | undefined;
110
+ idTokenClaims?: {
111
+ [x: string]: unknown;
112
+ aud?: string | undefined;
113
+ iss?: string | undefined;
114
+ iat?: number | undefined;
115
+ nbf?: number | undefined;
116
+ oid?: string | undefined;
117
+ sub?: string | undefined;
118
+ tid?: string | undefined;
119
+ tfp?: string | undefined;
120
+ acr?: string | undefined;
121
+ ver?: string | undefined;
122
+ upn?: string | undefined;
123
+ preferred_username?: string | undefined;
124
+ login_hint?: string | undefined;
125
+ emails?: string[] | undefined;
126
+ name?: string | undefined;
127
+ nonce?: string | undefined;
128
+ exp?: number | undefined;
129
+ home_oid?: string | undefined;
130
+ sid?: string | undefined;
131
+ cloud_instance_host_name?: string | undefined;
132
+ cnf?: {
133
+ kid: string;
134
+ } | undefined;
135
+ x5c_ca?: string[] | undefined;
136
+ ts?: number | undefined;
137
+ at?: string | undefined;
138
+ u?: string | undefined;
139
+ p?: string | undefined;
140
+ m?: string | undefined;
141
+ roles?: string[] | undefined;
142
+ amr?: string[] | undefined;
143
+ idp?: string | undefined;
144
+ auth_time?: number | undefined;
145
+ tenant_region_scope?: string | undefined;
146
+ tenant_region_sub_scope?: string | undefined;
147
+ } | undefined;
148
+ nativeAccountId?: string | undefined;
149
+ authorityType?: string | undefined;
150
+ tenantProfiles?: (Map<string, {
151
+ tenantId: string;
152
+ localAccountId: string;
153
+ name?: string | undefined;
154
+ isHomeTenant?: boolean | undefined;
155
+ }> & Omit<Map<string, TenantProfile>, keyof Map<any, any>>) | undefined;
156
+ } | null>;
157
+ token: Ref<string | null, string | null>;
158
+ error: Ref<Error | null, Error | null>;
159
+ activePolicy: Ref<string | null, string | null>;
160
+ authReady: Ref<boolean, boolean>;
161
+ userName: ComputedRef<string | null>;
162
+ signIn: (options?: SignInOptions) => Promise<void>;
163
+ signInCityEmployee: (options?: SignInOptions) => Promise<void>;
164
+ signOut: (options?: SignOutOptions) => Promise<void>;
165
+ forgotPassword: () => Promise<void>;
166
+ acquireToken: (options?: TokenOptions) => Promise<string | null>;
167
+ hasRole: (role: string) => boolean;
168
+ };
169
+
170
+ /**
171
+ * Access the raw SSOClient instance.
172
+ * Must be called within a component that is a descendant of createSSOPlugin.
173
+ */
174
+ export declare function useSSOClient(): SSOClient;
175
+
176
+ export declare const useSSOStore: StoreDefinition<"sso", Pick<{
177
+ isAuthenticated: Ref<boolean, boolean>;
178
+ isLoading: Ref<boolean, boolean>;
179
+ user: Ref< {
180
+ homeAccountId: string;
181
+ environment: string;
182
+ tenantId: string;
183
+ username: string;
184
+ localAccountId: string;
185
+ name?: string | undefined;
186
+ idToken?: string | undefined;
187
+ idTokenClaims?: {
188
+ [x: string]: unknown;
189
+ aud?: string | undefined;
190
+ iss?: string | undefined;
191
+ iat?: number | undefined;
192
+ nbf?: number | undefined;
193
+ oid?: string | undefined;
194
+ sub?: string | undefined;
195
+ tid?: string | undefined;
196
+ tfp?: string | undefined;
197
+ acr?: string | undefined;
198
+ ver?: string | undefined;
199
+ upn?: string | undefined;
200
+ preferred_username?: string | undefined;
201
+ login_hint?: string | undefined;
202
+ emails?: string[] | undefined;
203
+ name?: string | undefined;
204
+ nonce?: string | undefined;
205
+ exp?: number | undefined;
206
+ home_oid?: string | undefined;
207
+ sid?: string | undefined;
208
+ cloud_instance_host_name?: string | undefined;
209
+ cnf?: {
210
+ kid: string;
211
+ } | undefined;
212
+ x5c_ca?: string[] | undefined;
213
+ ts?: number | undefined;
214
+ at?: string | undefined;
215
+ u?: string | undefined;
216
+ p?: string | undefined;
217
+ m?: string | undefined;
218
+ roles?: string[] | undefined;
219
+ amr?: string[] | undefined;
220
+ idp?: string | undefined;
221
+ auth_time?: number | undefined;
222
+ tenant_region_scope?: string | undefined;
223
+ tenant_region_sub_scope?: string | undefined;
224
+ } | undefined;
225
+ nativeAccountId?: string | undefined;
226
+ authorityType?: string | undefined;
227
+ tenantProfiles?: (Map<string, {
228
+ tenantId: string;
229
+ localAccountId: string;
230
+ name?: string | undefined;
231
+ isHomeTenant?: boolean | undefined;
232
+ }> & Omit<Map<string, TenantProfile>, keyof Map<any, any>>) | undefined;
233
+ } | null, AccountInfo | {
234
+ homeAccountId: string;
235
+ environment: string;
236
+ tenantId: string;
237
+ username: string;
238
+ localAccountId: string;
239
+ name?: string | undefined;
240
+ idToken?: string | undefined;
241
+ idTokenClaims?: {
242
+ [x: string]: unknown;
243
+ aud?: string | undefined;
244
+ iss?: string | undefined;
245
+ iat?: number | undefined;
246
+ nbf?: number | undefined;
247
+ oid?: string | undefined;
248
+ sub?: string | undefined;
249
+ tid?: string | undefined;
250
+ tfp?: string | undefined;
251
+ acr?: string | undefined;
252
+ ver?: string | undefined;
253
+ upn?: string | undefined;
254
+ preferred_username?: string | undefined;
255
+ login_hint?: string | undefined;
256
+ emails?: string[] | undefined;
257
+ name?: string | undefined;
258
+ nonce?: string | undefined;
259
+ exp?: number | undefined;
260
+ home_oid?: string | undefined;
261
+ sid?: string | undefined;
262
+ cloud_instance_host_name?: string | undefined;
263
+ cnf?: {
264
+ kid: string;
265
+ } | undefined;
266
+ x5c_ca?: string[] | undefined;
267
+ ts?: number | undefined;
268
+ at?: string | undefined;
269
+ u?: string | undefined;
270
+ p?: string | undefined;
271
+ m?: string | undefined;
272
+ roles?: string[] | undefined;
273
+ amr?: string[] | undefined;
274
+ idp?: string | undefined;
275
+ auth_time?: number | undefined;
276
+ tenant_region_scope?: string | undefined;
277
+ tenant_region_sub_scope?: string | undefined;
278
+ } | undefined;
279
+ nativeAccountId?: string | undefined;
280
+ authorityType?: string | undefined;
281
+ tenantProfiles?: (Map<string, {
282
+ tenantId: string;
283
+ localAccountId: string;
284
+ name?: string | undefined;
285
+ isHomeTenant?: boolean | undefined;
286
+ }> & Omit<Map<string, TenantProfile>, keyof Map<any, any>>) | undefined;
287
+ } | null>;
288
+ token: Ref<string | null, string | null>;
289
+ error: Ref<Error | null, Error | null>;
290
+ activePolicy: Ref<string | null, string | null>;
291
+ authReady: Ref<boolean, boolean>;
292
+ syncState: (state: SSOClientState) => void;
293
+ }, "user" | "isAuthenticated" | "isLoading" | "token" | "error" | "activePolicy" | "authReady">, Pick<{
294
+ isAuthenticated: Ref<boolean, boolean>;
295
+ isLoading: Ref<boolean, boolean>;
296
+ user: Ref< {
297
+ homeAccountId: string;
298
+ environment: string;
299
+ tenantId: string;
300
+ username: string;
301
+ localAccountId: string;
302
+ name?: string | undefined;
303
+ idToken?: string | undefined;
304
+ idTokenClaims?: {
305
+ [x: string]: unknown;
306
+ aud?: string | undefined;
307
+ iss?: string | undefined;
308
+ iat?: number | undefined;
309
+ nbf?: number | undefined;
310
+ oid?: string | undefined;
311
+ sub?: string | undefined;
312
+ tid?: string | undefined;
313
+ tfp?: string | undefined;
314
+ acr?: string | undefined;
315
+ ver?: string | undefined;
316
+ upn?: string | undefined;
317
+ preferred_username?: string | undefined;
318
+ login_hint?: string | undefined;
319
+ emails?: string[] | undefined;
320
+ name?: string | undefined;
321
+ nonce?: string | undefined;
322
+ exp?: number | undefined;
323
+ home_oid?: string | undefined;
324
+ sid?: string | undefined;
325
+ cloud_instance_host_name?: string | undefined;
326
+ cnf?: {
327
+ kid: string;
328
+ } | undefined;
329
+ x5c_ca?: string[] | undefined;
330
+ ts?: number | undefined;
331
+ at?: string | undefined;
332
+ u?: string | undefined;
333
+ p?: string | undefined;
334
+ m?: string | undefined;
335
+ roles?: string[] | undefined;
336
+ amr?: string[] | undefined;
337
+ idp?: string | undefined;
338
+ auth_time?: number | undefined;
339
+ tenant_region_scope?: string | undefined;
340
+ tenant_region_sub_scope?: string | undefined;
341
+ } | undefined;
342
+ nativeAccountId?: string | undefined;
343
+ authorityType?: string | undefined;
344
+ tenantProfiles?: (Map<string, {
345
+ tenantId: string;
346
+ localAccountId: string;
347
+ name?: string | undefined;
348
+ isHomeTenant?: boolean | undefined;
349
+ }> & Omit<Map<string, TenantProfile>, keyof Map<any, any>>) | undefined;
350
+ } | null, AccountInfo | {
351
+ homeAccountId: string;
352
+ environment: string;
353
+ tenantId: string;
354
+ username: string;
355
+ localAccountId: string;
356
+ name?: string | undefined;
357
+ idToken?: string | undefined;
358
+ idTokenClaims?: {
359
+ [x: string]: unknown;
360
+ aud?: string | undefined;
361
+ iss?: string | undefined;
362
+ iat?: number | undefined;
363
+ nbf?: number | undefined;
364
+ oid?: string | undefined;
365
+ sub?: string | undefined;
366
+ tid?: string | undefined;
367
+ tfp?: string | undefined;
368
+ acr?: string | undefined;
369
+ ver?: string | undefined;
370
+ upn?: string | undefined;
371
+ preferred_username?: string | undefined;
372
+ login_hint?: string | undefined;
373
+ emails?: string[] | undefined;
374
+ name?: string | undefined;
375
+ nonce?: string | undefined;
376
+ exp?: number | undefined;
377
+ home_oid?: string | undefined;
378
+ sid?: string | undefined;
379
+ cloud_instance_host_name?: string | undefined;
380
+ cnf?: {
381
+ kid: string;
382
+ } | undefined;
383
+ x5c_ca?: string[] | undefined;
384
+ ts?: number | undefined;
385
+ at?: string | undefined;
386
+ u?: string | undefined;
387
+ p?: string | undefined;
388
+ m?: string | undefined;
389
+ roles?: string[] | undefined;
390
+ amr?: string[] | undefined;
391
+ idp?: string | undefined;
392
+ auth_time?: number | undefined;
393
+ tenant_region_scope?: string | undefined;
394
+ tenant_region_sub_scope?: string | undefined;
395
+ } | undefined;
396
+ nativeAccountId?: string | undefined;
397
+ authorityType?: string | undefined;
398
+ tenantProfiles?: (Map<string, {
399
+ tenantId: string;
400
+ localAccountId: string;
401
+ name?: string | undefined;
402
+ isHomeTenant?: boolean | undefined;
403
+ }> & Omit<Map<string, TenantProfile>, keyof Map<any, any>>) | undefined;
404
+ } | null>;
405
+ token: Ref<string | null, string | null>;
406
+ error: Ref<Error | null, Error | null>;
407
+ activePolicy: Ref<string | null, string | null>;
408
+ authReady: Ref<boolean, boolean>;
409
+ syncState: (state: SSOClientState) => void;
410
+ }, never>, Pick<{
411
+ isAuthenticated: Ref<boolean, boolean>;
412
+ isLoading: Ref<boolean, boolean>;
413
+ user: Ref< {
414
+ homeAccountId: string;
415
+ environment: string;
416
+ tenantId: string;
417
+ username: string;
418
+ localAccountId: string;
419
+ name?: string | undefined;
420
+ idToken?: string | undefined;
421
+ idTokenClaims?: {
422
+ [x: string]: unknown;
423
+ aud?: string | undefined;
424
+ iss?: string | undefined;
425
+ iat?: number | undefined;
426
+ nbf?: number | undefined;
427
+ oid?: string | undefined;
428
+ sub?: string | undefined;
429
+ tid?: string | undefined;
430
+ tfp?: string | undefined;
431
+ acr?: string | undefined;
432
+ ver?: string | undefined;
433
+ upn?: string | undefined;
434
+ preferred_username?: string | undefined;
435
+ login_hint?: string | undefined;
436
+ emails?: string[] | undefined;
437
+ name?: string | undefined;
438
+ nonce?: string | undefined;
439
+ exp?: number | undefined;
440
+ home_oid?: string | undefined;
441
+ sid?: string | undefined;
442
+ cloud_instance_host_name?: string | undefined;
443
+ cnf?: {
444
+ kid: string;
445
+ } | undefined;
446
+ x5c_ca?: string[] | undefined;
447
+ ts?: number | undefined;
448
+ at?: string | undefined;
449
+ u?: string | undefined;
450
+ p?: string | undefined;
451
+ m?: string | undefined;
452
+ roles?: string[] | undefined;
453
+ amr?: string[] | undefined;
454
+ idp?: string | undefined;
455
+ auth_time?: number | undefined;
456
+ tenant_region_scope?: string | undefined;
457
+ tenant_region_sub_scope?: string | undefined;
458
+ } | undefined;
459
+ nativeAccountId?: string | undefined;
460
+ authorityType?: string | undefined;
461
+ tenantProfiles?: (Map<string, {
462
+ tenantId: string;
463
+ localAccountId: string;
464
+ name?: string | undefined;
465
+ isHomeTenant?: boolean | undefined;
466
+ }> & Omit<Map<string, TenantProfile>, keyof Map<any, any>>) | undefined;
467
+ } | null, AccountInfo | {
468
+ homeAccountId: string;
469
+ environment: string;
470
+ tenantId: string;
471
+ username: string;
472
+ localAccountId: string;
473
+ name?: string | undefined;
474
+ idToken?: string | undefined;
475
+ idTokenClaims?: {
476
+ [x: string]: unknown;
477
+ aud?: string | undefined;
478
+ iss?: string | undefined;
479
+ iat?: number | undefined;
480
+ nbf?: number | undefined;
481
+ oid?: string | undefined;
482
+ sub?: string | undefined;
483
+ tid?: string | undefined;
484
+ tfp?: string | undefined;
485
+ acr?: string | undefined;
486
+ ver?: string | undefined;
487
+ upn?: string | undefined;
488
+ preferred_username?: string | undefined;
489
+ login_hint?: string | undefined;
490
+ emails?: string[] | undefined;
491
+ name?: string | undefined;
492
+ nonce?: string | undefined;
493
+ exp?: number | undefined;
494
+ home_oid?: string | undefined;
495
+ sid?: string | undefined;
496
+ cloud_instance_host_name?: string | undefined;
497
+ cnf?: {
498
+ kid: string;
499
+ } | undefined;
500
+ x5c_ca?: string[] | undefined;
501
+ ts?: number | undefined;
502
+ at?: string | undefined;
503
+ u?: string | undefined;
504
+ p?: string | undefined;
505
+ m?: string | undefined;
506
+ roles?: string[] | undefined;
507
+ amr?: string[] | undefined;
508
+ idp?: string | undefined;
509
+ auth_time?: number | undefined;
510
+ tenant_region_scope?: string | undefined;
511
+ tenant_region_sub_scope?: string | undefined;
512
+ } | undefined;
513
+ nativeAccountId?: string | undefined;
514
+ authorityType?: string | undefined;
515
+ tenantProfiles?: (Map<string, {
516
+ tenantId: string;
517
+ localAccountId: string;
518
+ name?: string | undefined;
519
+ isHomeTenant?: boolean | undefined;
520
+ }> & Omit<Map<string, TenantProfile>, keyof Map<any, any>>) | undefined;
521
+ } | null>;
522
+ token: Ref<string | null, string | null>;
523
+ error: Ref<Error | null, Error | null>;
524
+ activePolicy: Ref<string | null, string | null>;
525
+ authReady: Ref<boolean, boolean>;
526
+ syncState: (state: SSOClientState) => void;
527
+ }, "syncState">>;
528
+
529
+ export { }
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("vue"),y=require("pinia"),v=require("@phila/sso-core"),S=Symbol("sso-client"),g=y.defineStore("sso",()=>{const n=r.ref(!1),i=r.ref(!1),o=r.ref(null),t=r.ref(null),u=r.ref(null),l=r.ref(null),f=r.ref(!1);function d(s){n.value=s.isAuthenticated,i.value=s.isLoading,o.value=s.user,t.value=s.token,u.value=s.error,l.value=s.activePolicy,f.value=s.authReady}return{isAuthenticated:n,isLoading:i,user:o,token:t,error:u,activePolicy:l,authReady:f,syncState:d}});function C(n){return{install(i){const o=new v.SSOClient(n.clientConfig);i.provide(S,o),o.events.on("auth:stateChanged",t=>{g().syncState(t)}),n.autoInitialize!==!1&&o.initialize().then(t=>{t&&n.clientConfig.debug&&console.log("[sso-vue] Auto-initialized with response:",t)})}}}function m(){const n=r.inject(S);if(!n)throw new Error("SSOClient not found. Did you install createSSOPlugin?");return n}function E(){const n=g(),i=m(),{isAuthenticated:o,isLoading:t,user:u,token:l,error:f,activePolicy:d,authReady:s}=y.storeToRefs(n),O=r.computed(()=>{const e=u.value?.idTokenClaims;if(!e)return null;const c=e.given_name??e.name??"",a=e.family_name??"";return a?`${c} ${a}`.trim():c});async function P(e){await i.signIn(e)}async function h(e){await i.signInCityEmployee(e)}async function w(e){await i.signOut(e)}async function I(){await i.forgotPassword()}async function _(e){return i.acquireToken(e)}function A(e){const c=u.value?.idTokenClaims;if(!c)return!1;const a=c.roles??c.extension_Roles??[];return Array.isArray(a)&&a.includes(e)}return{isAuthenticated:o,isLoading:t,user:u,token:l,error:f,activePolicy:d,authReady:s,userName:O,signIn:P,signInCityEmployee:h,signOut:w,forgotPassword:I,acquireToken:_,hasRole:A}}function T(n={}){const{signInPolicy:i="B2C_1A_AD_SIGNIN_ONLY",resetPasswordPolicy:o="B2C_1A_PASSWORDRESET",debug:t=!1}=n;return C({clientConfig:{provider:new v.B2CProvider({clientId:void 0,b2cEnvironment:void 0,authorityDomain:void 0,redirectUri:void 0,policies:{signUpSignIn:i,signInOnly:i,resetPassword:o}}),debug:t}})}exports.SSO_CLIENT_KEY=S;exports.createB2CPlugin=T;exports.createSSOPlugin=C;exports.useAuth=E;exports.useSSOClient=m;exports.useSSOStore=g;
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../src/plugin.ts","../src/composables/useSSOClient.ts","../src/composables/useAuth.ts","../src/createB2CPlugin.ts"],"sourcesContent":["import { ref } from \"vue\";\nimport { defineStore } from \"pinia\";\nimport { SSOClient } from \"@phila/sso-core\";\nimport type { App } from \"vue\";\nimport type { SSOClientConfig, SSOClientState, AuthResponse } from \"@phila/sso-core\";\n\nexport const SSO_CLIENT_KEY = Symbol(\"sso-client\");\n\nexport interface SSOPluginOptions {\n clientConfig: SSOClientConfig;\n autoInitialize?: boolean;\n}\n\nexport const useSSOStore = defineStore(\"sso\", () => {\n const isAuthenticated = ref(false);\n const isLoading = ref(false);\n const user = ref<SSOClientState[\"user\"]>(null);\n const token = ref<string | null>(null);\n const error = ref<Error | null>(null);\n const activePolicy = ref<string | null>(null);\n const authReady = ref(false);\n\n function syncState(state: SSOClientState) {\n isAuthenticated.value = state.isAuthenticated;\n isLoading.value = state.isLoading;\n user.value = state.user;\n token.value = state.token;\n error.value = state.error;\n activePolicy.value = state.activePolicy;\n authReady.value = state.authReady;\n }\n\n return { isAuthenticated, isLoading, user, token, error, activePolicy, authReady, syncState };\n});\n\nexport function createSSOPlugin(options: SSOPluginOptions) {\n return {\n install(app: App) {\n const client = new SSOClient(options.clientConfig);\n\n // Provide the client for useSSOClient()\n app.provide(SSO_CLIENT_KEY, client);\n\n // Subscribe to state changes and sync to Pinia store\n client.events.on(\"auth:stateChanged\", (state: SSOClientState) => {\n const store = useSSOStore();\n store.syncState(state);\n });\n\n // Auto-initialize unless explicitly disabled\n if (options.autoInitialize !== false) {\n client.initialize().then((response: AuthResponse | null) => {\n if (response && options.clientConfig.debug) {\n console.log(\"[sso-vue] Auto-initialized with response:\", response);\n }\n });\n }\n },\n };\n}\n","import { inject } from \"vue\";\nimport { SSOClient } from \"@phila/sso-core\";\nimport { SSO_CLIENT_KEY } from \"../plugin\";\n\n/**\n * Access the raw SSOClient instance.\n * Must be called within a component that is a descendant of createSSOPlugin.\n */\nexport function useSSOClient(): SSOClient {\n const client = inject<SSOClient>(SSO_CLIENT_KEY);\n if (!client) {\n throw new Error(\"SSOClient not found. Did you install createSSOPlugin?\");\n }\n return client;\n}\n","import { computed } from \"vue\";\nimport { storeToRefs } from \"pinia\";\nimport { useSSOStore } from \"../plugin\";\nimport { useSSOClient } from \"./useSSOClient\";\nimport type { SignInOptions, SignOutOptions, TokenOptions } from \"@phila/sso-core\";\n\n/**\n * Primary composable for SSO authentication in Vue 3 apps.\n * API shape is intentionally similar to service-cat's existing useAuth()\n * to minimize migration friction.\n */\nexport function useAuth() {\n const store = useSSOStore();\n const client = useSSOClient();\n const { isAuthenticated, isLoading, user, token, error, activePolicy, authReady } = storeToRefs(store);\n\n // Computed helpers\n const userName = computed(() => {\n const claims = user.value?.idTokenClaims as Record<string, unknown> | undefined;\n if (!claims) return null;\n const given = (claims.given_name ?? claims.name ?? \"\") as string;\n const family = (claims.family_name ?? \"\") as string;\n return family ? `${given} ${family}`.trim() : given;\n });\n\n // Actions\n async function signIn(options?: SignInOptions): Promise<void> {\n await client.signIn(options);\n }\n\n async function signInCityEmployee(options?: SignInOptions): Promise<void> {\n await client.signInCityEmployee(options);\n }\n\n async function signOut(options?: SignOutOptions): Promise<void> {\n await client.signOut(options);\n }\n\n async function forgotPassword(): Promise<void> {\n await client.forgotPassword();\n }\n\n async function acquireToken(options?: TokenOptions): Promise<string | null> {\n return client.acquireToken(options);\n }\n\n // Utilities\n function hasRole(role: string): boolean {\n const claims = user.value?.idTokenClaims as Record<string, unknown> | undefined;\n if (!claims) return false;\n\n const roles = (claims.roles ?? claims.extension_Roles ?? []) as string[];\n return Array.isArray(roles) && roles.includes(role);\n }\n\n return {\n // State (readonly refs)\n isAuthenticated,\n isLoading,\n user,\n token,\n error,\n activePolicy,\n authReady,\n userName,\n\n // Actions\n signIn,\n signInCityEmployee,\n signOut,\n forgotPassword,\n acquireToken,\n\n // Utilities\n hasRole,\n };\n}\n","// ABOUTME: Convenience factory for vanilla Vue/Vite apps using Azure AD B2C\n// ABOUTME: Reads VITE_SSO_* env vars by convention so apps need zero B2CProvider boilerplate\nimport { B2CProvider } from \"@phila/sso-core\";\nimport { createSSOPlugin } from \"./plugin\";\n\nexport interface B2CPluginOptions {\n signInPolicy?: string;\n resetPasswordPolicy?: string;\n debug?: boolean;\n}\n\n/**\n * Creates a ready-to-use Vue plugin for Azure AD B2C authentication.\n * Reads connection details from VITE_SSO_* environment variables:\n * VITE_SSO_CLIENT_ID, VITE_SSO_TENANT, VITE_SSO_AUTHORITY_DOMAIN, VITE_SSO_REDIRECT_URI\n */\nexport function createB2CPlugin(options: B2CPluginOptions = {}) {\n const {\n signInPolicy = \"B2C_1A_AD_SIGNIN_ONLY\",\n resetPasswordPolicy = \"B2C_1A_PASSWORDRESET\",\n debug = import.meta.env.DEV,\n } = options;\n\n return createSSOPlugin({\n clientConfig: {\n provider: new B2CProvider({\n clientId: import.meta.env.VITE_SSO_CLIENT_ID,\n b2cEnvironment: import.meta.env.VITE_SSO_TENANT,\n authorityDomain: import.meta.env.VITE_SSO_AUTHORITY_DOMAIN,\n redirectUri: import.meta.env.VITE_SSO_REDIRECT_URI,\n policies: {\n signUpSignIn: signInPolicy,\n signInOnly: signInPolicy,\n resetPassword: resetPasswordPolicy,\n },\n }),\n debug,\n },\n });\n}\n"],"names":["SSO_CLIENT_KEY","useSSOStore","defineStore","isAuthenticated","ref","isLoading","user","token","error","activePolicy","authReady","syncState","state","createSSOPlugin","options","app","client","SSOClient","response","useSSOClient","inject","useAuth","store","storeToRefs","userName","computed","claims","given","family","signIn","signInCityEmployee","signOut","forgotPassword","acquireToken","hasRole","role","roles","createB2CPlugin","signInPolicy","resetPasswordPolicy","debug","B2CProvider"],"mappings":"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"}
package/dist/index.mjs ADDED
@@ -0,0 +1,108 @@
1
+ import { ref as c, inject as I, computed as O } from "vue";
2
+ import { defineStore as A, storeToRefs as _ } from "pinia";
3
+ import { SSOClient as p, B2CProvider as E } from "@phila/sso-core";
4
+ const g = /* @__PURE__ */ Symbol("sso-client"), y = A("sso", () => {
5
+ const e = c(!1), i = c(!1), o = c(null), t = c(null), r = c(null), l = c(null), f = c(!1);
6
+ function d(s) {
7
+ e.value = s.isAuthenticated, i.value = s.isLoading, o.value = s.user, t.value = s.token, r.value = s.error, l.value = s.activePolicy, f.value = s.authReady;
8
+ }
9
+ return { isAuthenticated: e, isLoading: i, user: o, token: t, error: r, activePolicy: l, authReady: f, syncState: d };
10
+ });
11
+ function R(e) {
12
+ return {
13
+ install(i) {
14
+ const o = new p(e.clientConfig);
15
+ i.provide(g, o), o.events.on("auth:stateChanged", (t) => {
16
+ y().syncState(t);
17
+ }), e.autoInitialize !== !1 && o.initialize().then((t) => {
18
+ t && e.clientConfig.debug && console.log("[sso-vue] Auto-initialized with response:", t);
19
+ });
20
+ }
21
+ };
22
+ }
23
+ function k() {
24
+ const e = I(g);
25
+ if (!e)
26
+ throw new Error("SSOClient not found. Did you install createSSOPlugin?");
27
+ return e;
28
+ }
29
+ function b() {
30
+ const e = y(), i = k(), { isAuthenticated: o, isLoading: t, user: r, token: l, error: f, activePolicy: d, authReady: s } = _(e), S = O(() => {
31
+ const n = r.value?.idTokenClaims;
32
+ if (!n) return null;
33
+ const a = n.given_name ?? n.name ?? "", u = n.family_name ?? "";
34
+ return u ? `${a} ${u}`.trim() : a;
35
+ });
36
+ async function m(n) {
37
+ await i.signIn(n);
38
+ }
39
+ async function v(n) {
40
+ await i.signInCityEmployee(n);
41
+ }
42
+ async function C(n) {
43
+ await i.signOut(n);
44
+ }
45
+ async function h() {
46
+ await i.forgotPassword();
47
+ }
48
+ async function P(n) {
49
+ return i.acquireToken(n);
50
+ }
51
+ function w(n) {
52
+ const a = r.value?.idTokenClaims;
53
+ if (!a) return !1;
54
+ const u = a.roles ?? a.extension_Roles ?? [];
55
+ return Array.isArray(u) && u.includes(n);
56
+ }
57
+ return {
58
+ // State (readonly refs)
59
+ isAuthenticated: o,
60
+ isLoading: t,
61
+ user: r,
62
+ token: l,
63
+ error: f,
64
+ activePolicy: d,
65
+ authReady: s,
66
+ userName: S,
67
+ // Actions
68
+ signIn: m,
69
+ signInCityEmployee: v,
70
+ signOut: C,
71
+ forgotPassword: h,
72
+ acquireToken: P,
73
+ // Utilities
74
+ hasRole: w
75
+ };
76
+ }
77
+ function B(e = {}) {
78
+ const {
79
+ signInPolicy: i = "B2C_1A_AD_SIGNIN_ONLY",
80
+ resetPasswordPolicy: o = "B2C_1A_PASSWORDRESET",
81
+ debug: t = !1
82
+ } = e;
83
+ return R({
84
+ clientConfig: {
85
+ provider: new E({
86
+ clientId: void 0,
87
+ b2cEnvironment: void 0,
88
+ authorityDomain: void 0,
89
+ redirectUri: void 0,
90
+ policies: {
91
+ signUpSignIn: i,
92
+ signInOnly: i,
93
+ resetPassword: o
94
+ }
95
+ }),
96
+ debug: t
97
+ }
98
+ });
99
+ }
100
+ export {
101
+ g as SSO_CLIENT_KEY,
102
+ B as createB2CPlugin,
103
+ R as createSSOPlugin,
104
+ b as useAuth,
105
+ k as useSSOClient,
106
+ y as useSSOStore
107
+ };
108
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","sources":["../src/plugin.ts","../src/composables/useSSOClient.ts","../src/composables/useAuth.ts","../src/createB2CPlugin.ts"],"sourcesContent":["import { ref } from \"vue\";\nimport { defineStore } from \"pinia\";\nimport { SSOClient } from \"@phila/sso-core\";\nimport type { App } from \"vue\";\nimport type { SSOClientConfig, SSOClientState, AuthResponse } from \"@phila/sso-core\";\n\nexport const SSO_CLIENT_KEY = Symbol(\"sso-client\");\n\nexport interface SSOPluginOptions {\n clientConfig: SSOClientConfig;\n autoInitialize?: boolean;\n}\n\nexport const useSSOStore = defineStore(\"sso\", () => {\n const isAuthenticated = ref(false);\n const isLoading = ref(false);\n const user = ref<SSOClientState[\"user\"]>(null);\n const token = ref<string | null>(null);\n const error = ref<Error | null>(null);\n const activePolicy = ref<string | null>(null);\n const authReady = ref(false);\n\n function syncState(state: SSOClientState) {\n isAuthenticated.value = state.isAuthenticated;\n isLoading.value = state.isLoading;\n user.value = state.user;\n token.value = state.token;\n error.value = state.error;\n activePolicy.value = state.activePolicy;\n authReady.value = state.authReady;\n }\n\n return { isAuthenticated, isLoading, user, token, error, activePolicy, authReady, syncState };\n});\n\nexport function createSSOPlugin(options: SSOPluginOptions) {\n return {\n install(app: App) {\n const client = new SSOClient(options.clientConfig);\n\n // Provide the client for useSSOClient()\n app.provide(SSO_CLIENT_KEY, client);\n\n // Subscribe to state changes and sync to Pinia store\n client.events.on(\"auth:stateChanged\", (state: SSOClientState) => {\n const store = useSSOStore();\n store.syncState(state);\n });\n\n // Auto-initialize unless explicitly disabled\n if (options.autoInitialize !== false) {\n client.initialize().then((response: AuthResponse | null) => {\n if (response && options.clientConfig.debug) {\n console.log(\"[sso-vue] Auto-initialized with response:\", response);\n }\n });\n }\n },\n };\n}\n","import { inject } from \"vue\";\nimport { SSOClient } from \"@phila/sso-core\";\nimport { SSO_CLIENT_KEY } from \"../plugin\";\n\n/**\n * Access the raw SSOClient instance.\n * Must be called within a component that is a descendant of createSSOPlugin.\n */\nexport function useSSOClient(): SSOClient {\n const client = inject<SSOClient>(SSO_CLIENT_KEY);\n if (!client) {\n throw new Error(\"SSOClient not found. Did you install createSSOPlugin?\");\n }\n return client;\n}\n","import { computed } from \"vue\";\nimport { storeToRefs } from \"pinia\";\nimport { useSSOStore } from \"../plugin\";\nimport { useSSOClient } from \"./useSSOClient\";\nimport type { SignInOptions, SignOutOptions, TokenOptions } from \"@phila/sso-core\";\n\n/**\n * Primary composable for SSO authentication in Vue 3 apps.\n * API shape is intentionally similar to service-cat's existing useAuth()\n * to minimize migration friction.\n */\nexport function useAuth() {\n const store = useSSOStore();\n const client = useSSOClient();\n const { isAuthenticated, isLoading, user, token, error, activePolicy, authReady } = storeToRefs(store);\n\n // Computed helpers\n const userName = computed(() => {\n const claims = user.value?.idTokenClaims as Record<string, unknown> | undefined;\n if (!claims) return null;\n const given = (claims.given_name ?? claims.name ?? \"\") as string;\n const family = (claims.family_name ?? \"\") as string;\n return family ? `${given} ${family}`.trim() : given;\n });\n\n // Actions\n async function signIn(options?: SignInOptions): Promise<void> {\n await client.signIn(options);\n }\n\n async function signInCityEmployee(options?: SignInOptions): Promise<void> {\n await client.signInCityEmployee(options);\n }\n\n async function signOut(options?: SignOutOptions): Promise<void> {\n await client.signOut(options);\n }\n\n async function forgotPassword(): Promise<void> {\n await client.forgotPassword();\n }\n\n async function acquireToken(options?: TokenOptions): Promise<string | null> {\n return client.acquireToken(options);\n }\n\n // Utilities\n function hasRole(role: string): boolean {\n const claims = user.value?.idTokenClaims as Record<string, unknown> | undefined;\n if (!claims) return false;\n\n const roles = (claims.roles ?? claims.extension_Roles ?? []) as string[];\n return Array.isArray(roles) && roles.includes(role);\n }\n\n return {\n // State (readonly refs)\n isAuthenticated,\n isLoading,\n user,\n token,\n error,\n activePolicy,\n authReady,\n userName,\n\n // Actions\n signIn,\n signInCityEmployee,\n signOut,\n forgotPassword,\n acquireToken,\n\n // Utilities\n hasRole,\n };\n}\n","// ABOUTME: Convenience factory for vanilla Vue/Vite apps using Azure AD B2C\n// ABOUTME: Reads VITE_SSO_* env vars by convention so apps need zero B2CProvider boilerplate\nimport { B2CProvider } from \"@phila/sso-core\";\nimport { createSSOPlugin } from \"./plugin\";\n\nexport interface B2CPluginOptions {\n signInPolicy?: string;\n resetPasswordPolicy?: string;\n debug?: boolean;\n}\n\n/**\n * Creates a ready-to-use Vue plugin for Azure AD B2C authentication.\n * Reads connection details from VITE_SSO_* environment variables:\n * VITE_SSO_CLIENT_ID, VITE_SSO_TENANT, VITE_SSO_AUTHORITY_DOMAIN, VITE_SSO_REDIRECT_URI\n */\nexport function createB2CPlugin(options: B2CPluginOptions = {}) {\n const {\n signInPolicy = \"B2C_1A_AD_SIGNIN_ONLY\",\n resetPasswordPolicy = \"B2C_1A_PASSWORDRESET\",\n debug = import.meta.env.DEV,\n } = options;\n\n return createSSOPlugin({\n clientConfig: {\n provider: new B2CProvider({\n clientId: import.meta.env.VITE_SSO_CLIENT_ID,\n b2cEnvironment: import.meta.env.VITE_SSO_TENANT,\n authorityDomain: import.meta.env.VITE_SSO_AUTHORITY_DOMAIN,\n redirectUri: import.meta.env.VITE_SSO_REDIRECT_URI,\n policies: {\n signUpSignIn: signInPolicy,\n signInOnly: signInPolicy,\n resetPassword: resetPasswordPolicy,\n },\n }),\n debug,\n },\n });\n}\n"],"names":["SSO_CLIENT_KEY","useSSOStore","defineStore","isAuthenticated","ref","isLoading","user","token","error","activePolicy","authReady","syncState","state","createSSOPlugin","options","app","client","SSOClient","response","useSSOClient","inject","useAuth","store","storeToRefs","userName","computed","claims","given","family","signIn","signInCityEmployee","signOut","forgotPassword","acquireToken","hasRole","role","roles","createB2CPlugin","signInPolicy","resetPasswordPolicy","debug","B2CProvider"],"mappings":"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"}
package/package.json ADDED
@@ -0,0 +1,57 @@
1
+ {
2
+ "name": "@phila/sso-vue",
3
+ "version": "0.0.1",
4
+ "type": "module",
5
+ "description": "Vue 3 adapter for @phila/sso-core",
6
+ "main": "./dist/index.js",
7
+ "module": "./dist/index.mjs",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.mjs",
13
+ "require": "./dist/index.js"
14
+ }
15
+ },
16
+ "files": [
17
+ "dist"
18
+ ],
19
+ "keywords": [
20
+ "sso",
21
+ "vue",
22
+ "pinia",
23
+ "authentication",
24
+ "composable"
25
+ ],
26
+ "author": "City of Philadelphia",
27
+ "license": "MIT",
28
+ "dependencies": {
29
+ "@phila/sso-core": "0.0.1"
30
+ },
31
+ "peerDependencies": {
32
+ "vue": "^3.0.0",
33
+ "pinia": "^2.0.0"
34
+ },
35
+ "devDependencies": {
36
+ "@types/node": "^24.0.0",
37
+ "@vitejs/plugin-vue": "^6.0.1",
38
+ "eslint": "^9.0.0",
39
+ "pinia": "^2.0.0",
40
+ "typescript": "^5.9.3",
41
+ "vite": "^7.0.6",
42
+ "vite-plugin-dts": "^3.9.1",
43
+ "vue": "^3.5.18"
44
+ },
45
+ "scripts": {
46
+ "build": "vite build",
47
+ "dev": "vite build --watch",
48
+ "lint": "eslint src/**/*.ts",
49
+ "lint:fix": "eslint src/**/*.ts --fix",
50
+ "type-check": "tsc --noEmit",
51
+ "clean": "rm -rf dist",
52
+ "test": "vitest run --passWithNoTests",
53
+ "test:watch": "vitest",
54
+ "format": "prettier --write .",
55
+ "format:check": "prettier --check ."
56
+ }
57
+ }