@sbc-connect/nuxt-auth 0.14.0 → 0.16.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/CHANGELOG.md +18 -0
- package/app/app.config.ts +1 -2
- package/app/composables/useConnectAppConfig.ts +3 -4
- package/app/interfaces/app-config-shapes.ts +12 -1
- package/app/middleware/02.app-config-presets.global.ts +9 -7
- package/app/middleware/03.idp-enforcement.global.ts +2 -2
- package/app/types/auth-app-config.d.ts +1 -1
- package/app/types/auth-plugins.d.ts +11 -0
- package/app/types/connect-valid-idps.ts +0 -2
- package/app/utils/index.ts +0 -1
- package/nuxt.config.ts +2 -2
- package/package.json +6 -6
- package/app/enums/connect-preset-type.ts +0 -4
- package/app/utils/constants/index.ts +0 -1
- package/app/utils/constants/valid-idps.ts +0 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @sbc-connect/nuxt-auth
|
|
2
2
|
|
|
3
|
+
## 0.16.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#183](https://github.com/bcgov/connect-nuxt/pull/183) [`7319c2e`](https://github.com/bcgov/connect-nuxt/commit/7319c2ec4da24854e67fab7446dac11e3f936b8f) Thanks [@deetz99](https://github.com/deetz99)! - Loosen typing for idps in app config, delete unused ConnectValidIdps type and getValidIdps function.
|
|
8
|
+
|
|
9
|
+
## 0.15.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [#180](https://github.com/bcgov/connect-nuxt/pull/180) [`4e25088`](https://github.com/bcgov/connect-nuxt/commit/4e250886da973eda99044ff1c34383604b05d718) Thanks [@deetz99](https://github.com/deetz99)! - Force type resolutions via nuxt config prepare:types hook.
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- Updated dependencies [[`4e25088`](https://github.com/bcgov/connect-nuxt/commit/4e250886da973eda99044ff1c34383604b05d718)]:
|
|
18
|
+
- @sbc-connect/nuxt-base@0.12.0
|
|
19
|
+
- @sbc-connect/nuxt-forms@0.7.7
|
|
20
|
+
|
|
3
21
|
## 0.14.0
|
|
4
22
|
|
|
5
23
|
### Minor Changes
|
package/app/app.config.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { ConnectIdpHint } from './enums/connect-idp-hint'
|
|
2
1
|
import type { AppConfigInput } from 'nuxt/schema'
|
|
3
2
|
|
|
4
3
|
export default defineAppConfig({
|
|
5
4
|
connect: {
|
|
6
5
|
login: {
|
|
7
6
|
redirect: '/',
|
|
8
|
-
idps: [
|
|
7
|
+
idps: ['bcsc', 'bceid', 'idir'],
|
|
9
8
|
skipAccountRedirect: false,
|
|
10
9
|
idpEnforcement: false
|
|
11
10
|
},
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
3
2
|
export const useConnectAppConfig = () => {
|
|
4
3
|
/**
|
|
5
4
|
* Merge preset overrides (from app.config.connectOverrides) into the provided baseConfig.
|
|
@@ -7,10 +6,10 @@ export const useConnectAppConfig = () => {
|
|
|
7
6
|
*/
|
|
8
7
|
function mergeAppConfigOverrides(
|
|
9
8
|
baseConfig: ConnectConfig,
|
|
10
|
-
presetName:
|
|
9
|
+
presetName: string
|
|
11
10
|
): ConnectConfig {
|
|
12
11
|
const appConfig = useAppConfig()
|
|
13
|
-
const overrides = appConfig.connectOverrides?.[presetName] ?? null
|
|
12
|
+
const overrides = (appConfig.connectOverrides as Record<string, any>)?.[presetName] ?? null
|
|
14
13
|
|
|
15
14
|
return {
|
|
16
15
|
...baseConfig,
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
type IdpList = Array<'bcsc' | 'bceid' | 'idir'>
|
|
2
|
+
|
|
1
3
|
export interface ConnectLoginConfig {
|
|
2
4
|
redirect: string
|
|
3
|
-
idps:
|
|
5
|
+
idps: IdpList
|
|
4
6
|
skipAccountRedirect: boolean
|
|
5
7
|
idpEnforcement: boolean
|
|
6
8
|
alert?: {
|
|
@@ -9,6 +11,8 @@ export interface ConnectLoginConfig {
|
|
|
9
11
|
}
|
|
10
12
|
}
|
|
11
13
|
|
|
14
|
+
export type ConnectLoginConfigInput = Partial<ConnectLoginConfig>
|
|
15
|
+
|
|
12
16
|
export interface ConnectLogoutConfig {
|
|
13
17
|
redirect: string
|
|
14
18
|
}
|
|
@@ -33,6 +37,13 @@ export interface ConnectConfig {
|
|
|
33
37
|
footer?: ConnectFooterConfig
|
|
34
38
|
}
|
|
35
39
|
|
|
40
|
+
export interface ConnectConfigInput {
|
|
41
|
+
login?: Partial<ConnectLoginConfigInput>
|
|
42
|
+
logout?: Partial<ConnectLogoutConfig>
|
|
43
|
+
header?: Partial<ConnectHeaderConfig>
|
|
44
|
+
footer?: Partial<ConnectFooterConfig>
|
|
45
|
+
}
|
|
46
|
+
|
|
36
47
|
export interface ConnectPresetOverrides {
|
|
37
48
|
login?: Partial<ConnectLoginConfig>
|
|
38
49
|
header?: Partial<ConnectHeaderConfig>
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
export default defineNuxtRouteMiddleware((to) => {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
if (to.query.preset) {
|
|
3
|
+
const appConfig = useAppConfig()
|
|
4
|
+
const { mergeAppConfigOverrides } = useConnectAppConfig()
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
// Build and assign app.config presets
|
|
7
|
+
appConfig.connect = mergeAppConfigOverrides(
|
|
8
|
+
appConfig.connect as ConnectConfig,
|
|
9
|
+
to.query.preset as string
|
|
10
|
+
)
|
|
11
|
+
}
|
|
10
12
|
})
|
|
@@ -9,11 +9,11 @@ export default defineNuxtRouteMiddleware(async (to) => {
|
|
|
9
9
|
// IDP Enforcement Config
|
|
10
10
|
const connectConfig = appConfig.connect as ConnectConfig
|
|
11
11
|
const idpEnforcement = connectConfig?.login?.idpEnforcement
|
|
12
|
-
const allowedIdps = connectConfig?.login?.idps
|
|
12
|
+
const allowedIdps = connectConfig?.login?.idps as string[]
|
|
13
13
|
|
|
14
14
|
if (idpEnforcement && authUser.value?.loginSource) {
|
|
15
15
|
// User's IDP is not allowed, display idp enforcement modal
|
|
16
|
-
if (!allowedIdps?.includes(authUser.value?.loginSource.toLowerCase()
|
|
16
|
+
if (!allowedIdps?.includes(authUser.value?.loginSource.toLowerCase())) {
|
|
17
17
|
// Pass redirect url to preserve any query params
|
|
18
18
|
const pathWithQuery = withQuery(localePath('/auth/login'), to.query)
|
|
19
19
|
const url = `${window.location.origin}${pathWithQuery}`
|
package/app/utils/index.ts
CHANGED
package/nuxt.config.ts
CHANGED
|
@@ -96,11 +96,11 @@ export default defineNuxtConfig({
|
|
|
96
96
|
// Can also force sharedReferences, nodeReferences - and nitro references using the 'nitro:prepare:types' hook
|
|
97
97
|
hooks: {
|
|
98
98
|
'prepare:types': ({ references }) => {
|
|
99
|
-
// force `#app` augmentations
|
|
100
99
|
references.push(
|
|
101
100
|
{ path: resolve('./app/types/auth-app-config.d.ts') },
|
|
102
101
|
{ path: resolve('./app/types/auth-nuxt-hooks.d.ts') },
|
|
103
|
-
{ path: resolve('./app/types/auth-page-meta.d.ts') }
|
|
102
|
+
{ path: resolve('./app/types/auth-page-meta.d.ts') },
|
|
103
|
+
{ path: resolve('./app/types/auth-plugins.d.ts') }
|
|
104
104
|
)
|
|
105
105
|
}
|
|
106
106
|
}
|
package/package.json
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sbc-connect/nuxt-auth",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.16.0",
|
|
5
5
|
"repository": "github:bcgov/connect-nuxt",
|
|
6
6
|
"license": "BSD-3-Clause",
|
|
7
7
|
"main": "./nuxt.config.ts",
|
|
8
8
|
"devDependencies": {
|
|
9
9
|
"@axe-core/playwright": "4.11.3",
|
|
10
10
|
"dotenv": "17.4.2",
|
|
11
|
-
"nuxt": "4.4.
|
|
11
|
+
"nuxt": "4.4.8",
|
|
12
12
|
"typescript": "6.0.3",
|
|
13
13
|
"vue-tsc": "3.3.1",
|
|
14
14
|
"@sbc-connect/eslint-config": "0.0.8",
|
|
15
|
-
"@sbc-connect/
|
|
16
|
-
"@sbc-connect/
|
|
15
|
+
"@sbc-connect/playwright-config": "0.2.0",
|
|
16
|
+
"@sbc-connect/vitest-config": "0.2.0"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"@pinia/colada": "1.3.0",
|
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
"keycloak-js": "26.2.4",
|
|
23
23
|
"pinia": "3.0.4",
|
|
24
24
|
"pinia-plugin-persistedstate": "4.7.1",
|
|
25
|
-
"@sbc-connect/nuxt-base": "0.
|
|
26
|
-
"@sbc-connect/nuxt-forms": "0.7.
|
|
25
|
+
"@sbc-connect/nuxt-base": "0.12.0",
|
|
26
|
+
"@sbc-connect/nuxt-forms": "0.7.7"
|
|
27
27
|
},
|
|
28
28
|
"scripts": {
|
|
29
29
|
"preinstall": "npx only-allow pnpm",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './valid-idps'
|