@thunderid/nuxt 0.2.0 → 0.2.2
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.json +1 -1
- package/dist/module.mjs +0 -46
- package/dist/runtime/components/ThunderIDRoot.d.ts +3 -7
- package/dist/runtime/components/ThunderIDRoot.js +22 -92
- package/dist/runtime/components/auth/SignUp.js +1 -4
- package/dist/runtime/composables/useThunderID.js +1 -12
- package/dist/runtime/errors/error-codes.d.ts +0 -2
- package/dist/runtime/errors/error-codes.js +0 -2
- package/dist/runtime/plugins/thunderid.d.ts +2 -3
- package/dist/runtime/plugins/thunderid.js +1 -13
- package/dist/runtime/server/ThunderIDNuxtClient.d.ts +2 -10
- package/dist/runtime/server/ThunderIDNuxtClient.js +3 -116
- package/dist/runtime/server/plugins/thunderid-ssr.d.ts +1 -3
- package/dist/runtime/server/plugins/thunderid-ssr.js +2 -22
- package/dist/runtime/server/routes/auth/session/signin.post.d.ts +1 -1
- package/dist/runtime/server/routes/auth/session/signin.post.js +1 -1
- package/dist/runtime/server/routes/auth/session/signup.post.js +2 -2
- package/dist/runtime/types.d.ts +1 -20
- package/package.json +9 -9
- package/dist/runtime/components/organization/CreateOrganization.d.ts +0 -32
- package/dist/runtime/components/organization/CreateOrganization.js +0 -29
- package/dist/runtime/components/organization/Organization.d.ts +0 -39
- package/dist/runtime/components/organization/Organization.js +0 -17
- package/dist/runtime/components/organization/OrganizationList.d.ts +0 -34
- package/dist/runtime/components/organization/OrganizationList.js +0 -30
- package/dist/runtime/components/organization/OrganizationProfile.d.ts +0 -32
- package/dist/runtime/components/organization/OrganizationProfile.js +0 -32
- package/dist/runtime/components/organization/OrganizationSwitcher.d.ts +0 -36
- package/dist/runtime/components/organization/OrganizationSwitcher.js +0 -26
- package/dist/runtime/server/routes/auth/branding/branding.get.d.ts +0 -31
- package/dist/runtime/server/routes/auth/branding/branding.get.js +0 -40
- package/dist/runtime/server/routes/auth/organizations/current.get.d.ts +0 -29
- package/dist/runtime/server/routes/auth/organizations/current.get.js +0 -24
- package/dist/runtime/server/routes/auth/organizations/id.get.d.ts +0 -28
- package/dist/runtime/server/routes/auth/organizations/id.get.js +0 -28
- package/dist/runtime/server/routes/auth/organizations/index.get.d.ts +0 -28
- package/dist/runtime/server/routes/auth/organizations/index.get.js +0 -24
- package/dist/runtime/server/routes/auth/organizations/index.post.d.ts +0 -30
- package/dist/runtime/server/routes/auth/organizations/index.post.js +0 -30
- package/dist/runtime/server/routes/auth/organizations/me.get.d.ts +0 -28
- package/dist/runtime/server/routes/auth/organizations/me.get.js +0 -24
- package/dist/runtime/server/routes/auth/organizations/switch.post.d.ts +0 -32
- package/dist/runtime/server/routes/auth/organizations/switch.post.js +0 -49
package/dist/runtime/types.d.ts
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* specific language governing permissions and limitations
|
|
16
16
|
* under the License.
|
|
17
17
|
*/
|
|
18
|
-
import type {
|
|
18
|
+
import type { I18nPreferences, TokenEndpointAuthMethod, User, UserProfile } from '@thunderid/node';
|
|
19
19
|
import type { JWTPayload } from 'jose';
|
|
20
20
|
/**
|
|
21
21
|
* Configuration for the ThunderID Nuxt module.
|
|
@@ -36,12 +36,6 @@ export interface ThunderIDNuxtConfig {
|
|
|
36
36
|
clientId?: string;
|
|
37
37
|
/** OAuth2 Client Secret (server-only, use THUNDERID_CLIENT_SECRET env var) */
|
|
38
38
|
clientSecret?: string;
|
|
39
|
-
/**
|
|
40
|
-
* Identity platform variant. Set to `Platform.ThunderID` when connecting to
|
|
41
|
-
* a Thunder (ThunderIDV2) instance. Forwarded to the underlying Node client so
|
|
42
|
-
* platform-specific behaviours (e.g. issuer resolution) apply correctly.
|
|
43
|
-
*/
|
|
44
|
-
platform?: keyof typeof Platform;
|
|
45
39
|
/**
|
|
46
40
|
* Feature-gating preferences that control which server-side data fetches
|
|
47
41
|
* the Nitro plugin performs on every SSR request.
|
|
@@ -50,11 +44,6 @@ export interface ThunderIDNuxtConfig {
|
|
|
50
44
|
/** i18n configuration forwarded to `I18nProvider`. */
|
|
51
45
|
i18n?: I18nPreferences;
|
|
52
46
|
theme?: {
|
|
53
|
-
/**
|
|
54
|
-
* When true (default), the Nitro plugin fetches the branding preference
|
|
55
|
-
* from ThunderID and passes it to `BrandingProvider` / `ThemeProvider`.
|
|
56
|
-
*/
|
|
57
|
-
inheritFromBranding?: boolean;
|
|
58
47
|
/**
|
|
59
48
|
* Theme mode forwarded to the Vue SDK's `ThemeProvider`.
|
|
60
49
|
* - `'light'` (default) | `'dark'`: Fixed color scheme. Toggle at runtime with `useTheme().toggleTheme()`.
|
|
@@ -65,8 +54,6 @@ export interface ThunderIDNuxtConfig {
|
|
|
65
54
|
mode?: 'light' | 'dark' | 'system' | 'class' | 'branding';
|
|
66
55
|
};
|
|
67
56
|
user?: {
|
|
68
|
-
/** Whether to fetch the user's organisations during SSR (default: true). */
|
|
69
|
-
fetchOrganizations?: boolean;
|
|
70
57
|
/** Whether to fetch the SCIM2 user profile during SSR (default: true). */
|
|
71
58
|
fetchUserProfile?: boolean;
|
|
72
59
|
};
|
|
@@ -132,13 +119,7 @@ export interface ThunderIDTempSessionPayload extends JWTPayload {
|
|
|
132
119
|
* hydrated `useState` keys so the client never re-fetches on first render.
|
|
133
120
|
*/
|
|
134
121
|
export interface ThunderIDSSRData {
|
|
135
|
-
/** Branding preference fetched from ThunderID (null when `preferences.theme.inheritFromBranding` is false). */
|
|
136
|
-
brandingPreference: BrandingPreference | null;
|
|
137
|
-
/** The organisation the user is currently acting within (null when not in an org). */
|
|
138
|
-
currentOrganization: Organization | null;
|
|
139
122
|
isSignedIn: boolean;
|
|
140
|
-
/** All organisations the user is a member of (empty array when `preferences.user.fetchOrganizations` is false). */
|
|
141
|
-
myOrganizations: Organization[];
|
|
142
123
|
/**
|
|
143
124
|
* The base URL actually used for this request.
|
|
144
125
|
* Equals `${baseUrl}/o` when the user is acting within an organisation
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thunderid/nuxt",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "Nuxt SDK for ThunderID",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"thunderid",
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"nuxtjs",
|
|
9
9
|
"ssr"
|
|
10
10
|
],
|
|
11
|
-
"homepage": "https://github.com/thunder-id/
|
|
11
|
+
"homepage": "https://github.com/thunder-id/javascript-sdks/tree/main/packages/nuxt#readme",
|
|
12
12
|
"bugs": {
|
|
13
13
|
"url": "https://github.com/thunder-id/thunderid/issues"
|
|
14
14
|
},
|
|
@@ -57,30 +57,30 @@
|
|
|
57
57
|
],
|
|
58
58
|
"repository": {
|
|
59
59
|
"type": "git",
|
|
60
|
-
"url": "https://github.com/thunder-id/
|
|
60
|
+
"url": "https://github.com/thunder-id/javascript-sdks",
|
|
61
61
|
"directory": "packages/nuxt"
|
|
62
62
|
},
|
|
63
63
|
"dependencies": {
|
|
64
64
|
"@nuxt/kit": "3.21.7",
|
|
65
65
|
"defu": "6.1.5",
|
|
66
66
|
"jose": "5.2.0",
|
|
67
|
-
"@thunderid/node": "^0.2.
|
|
68
|
-
"@thunderid/vue": "^0.3.
|
|
69
|
-
"@thunderid/browser": "^0.3.
|
|
67
|
+
"@thunderid/node": "^0.2.2",
|
|
68
|
+
"@thunderid/vue": "^0.3.4",
|
|
69
|
+
"@thunderid/browser": "^0.3.2"
|
|
70
70
|
},
|
|
71
71
|
"devDependencies": {
|
|
72
72
|
"@nuxt/devtools": "2.6.4",
|
|
73
73
|
"@nuxt/module-builder": "1.0.1",
|
|
74
74
|
"@nuxt/schema": "3.21.7",
|
|
75
75
|
"@nuxt/test-utils": "3.17.2",
|
|
76
|
+
"@thunderid/eslint-plugin": "0.0.2",
|
|
77
|
+
"@thunderid/prettier-config": "0.0.2",
|
|
76
78
|
"@types/node": "24.7.2",
|
|
77
79
|
"eslint": "9.39.4",
|
|
78
80
|
"h3": "1.15.11",
|
|
79
81
|
"nuxt": "3.21.7",
|
|
80
82
|
"typescript": "5.9.3",
|
|
81
|
-
"vitest": "4.1.8"
|
|
82
|
-
"@thunderid/eslint-plugin": "^0.0.0",
|
|
83
|
-
"@thunderid/prettier-config": "^0.0.0"
|
|
83
|
+
"vitest": "4.1.8"
|
|
84
84
|
},
|
|
85
85
|
"peerDependencies": {
|
|
86
86
|
"nuxt": ">=3.10.0",
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
|
|
3
|
-
*
|
|
4
|
-
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
5
|
-
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
-
* in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing,
|
|
12
|
-
* software distributed under the License is distributed on an
|
|
13
|
-
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
-
* KIND, either express or implied. See the License for the
|
|
15
|
-
* specific language governing permissions and limitations
|
|
16
|
-
* under the License.
|
|
17
|
-
*/
|
|
18
|
-
import { type Component } from 'vue';
|
|
19
|
-
/**
|
|
20
|
-
* Nuxt-specific CreateOrganization container.
|
|
21
|
-
*
|
|
22
|
-
* Reads `createOrganization` from `useOrganization()` (Nuxt auto-import,
|
|
23
|
-
* re-exported from `@thunderid/vue`) and delegates rendering to
|
|
24
|
-
* {@link BaseCreateOrganization} from `@thunderid/vue`.
|
|
25
|
-
*
|
|
26
|
-
* @example
|
|
27
|
-
* ```vue
|
|
28
|
-
* <ThunderIDCreateOrganization title="New Team" />
|
|
29
|
-
* ```
|
|
30
|
-
*/
|
|
31
|
-
declare const CreateOrganization: Component;
|
|
32
|
-
export default CreateOrganization;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { withVendorCSSClassPrefix } from "@thunderid/browser";
|
|
2
|
-
import { BaseCreateOrganization } from "@thunderid/vue";
|
|
3
|
-
import { defineComponent, h } from "vue";
|
|
4
|
-
import { useOrganization } from "#imports";
|
|
5
|
-
const CreateOrganization = defineComponent({
|
|
6
|
-
name: "CreateOrganization",
|
|
7
|
-
props: {
|
|
8
|
-
className: { default: "", type: String },
|
|
9
|
-
description: { default: "Create a new sub-organization.", type: String },
|
|
10
|
-
title: { default: "Create Organization", type: String }
|
|
11
|
-
},
|
|
12
|
-
setup(props, { slots }) {
|
|
13
|
-
const { createOrganization } = useOrganization();
|
|
14
|
-
return () => h(
|
|
15
|
-
BaseCreateOrganization,
|
|
16
|
-
{
|
|
17
|
-
class: withVendorCSSClassPrefix("create-organization--styled"),
|
|
18
|
-
className: props.className,
|
|
19
|
-
description: props.description,
|
|
20
|
-
onCreate: createOrganization ? async (name) => {
|
|
21
|
-
await createOrganization({ description: "", name, parentId: "", type: "TENANT" }, "");
|
|
22
|
-
} : void 0,
|
|
23
|
-
title: props.title
|
|
24
|
-
},
|
|
25
|
-
slots
|
|
26
|
-
);
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
export default CreateOrganization;
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
|
|
3
|
-
*
|
|
4
|
-
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
5
|
-
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
-
* in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing,
|
|
12
|
-
* software distributed under the License is distributed on an
|
|
13
|
-
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
-
* KIND, either express or implied. See the License for the
|
|
15
|
-
* specific language governing permissions and limitations
|
|
16
|
-
* under the License.
|
|
17
|
-
*/
|
|
18
|
-
import { type Component } from 'vue';
|
|
19
|
-
/**
|
|
20
|
-
* Nuxt-specific Organization control component.
|
|
21
|
-
*
|
|
22
|
-
* Exposes the current organization via a scoped slot. Renders the `fallback`
|
|
23
|
-
* slot when no organization is selected.
|
|
24
|
-
*
|
|
25
|
-
* Uses `useOrganization()` from the Nuxt auto-import layer (re-exported from
|
|
26
|
-
* `@thunderid/vue`) so it reads from the OrganizationProvider context.
|
|
27
|
-
*
|
|
28
|
-
* @example
|
|
29
|
-
* ```vue
|
|
30
|
-
* <ThunderIDOrganization>
|
|
31
|
-
* <template #default="{ organization }">
|
|
32
|
-
* <p>Current org: {{ organization.name }}</p>
|
|
33
|
-
* </template>
|
|
34
|
-
* <template #fallback><p>No organization selected.</p></template>
|
|
35
|
-
* </ThunderIDOrganization>
|
|
36
|
-
* ```
|
|
37
|
-
*/
|
|
38
|
-
declare const Organization: Component;
|
|
39
|
-
export default Organization;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { Fragment, defineComponent, h } from "vue";
|
|
2
|
-
import { useOrganization } from "#imports";
|
|
3
|
-
const Organization = defineComponent({
|
|
4
|
-
name: "Organization",
|
|
5
|
-
setup(_props, { slots }) {
|
|
6
|
-
const { currentOrganization } = useOrganization();
|
|
7
|
-
return () => {
|
|
8
|
-
if (!currentOrganization?.value) {
|
|
9
|
-
const fallback = slots.fallback?.();
|
|
10
|
-
return fallback ? h(Fragment, {}, fallback) : null;
|
|
11
|
-
}
|
|
12
|
-
const content = slots.default?.({ organization: currentOrganization.value });
|
|
13
|
-
return content ? h(Fragment, {}, content) : null;
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
});
|
|
17
|
-
export default Organization;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
|
|
3
|
-
*
|
|
4
|
-
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
5
|
-
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
-
* in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing,
|
|
12
|
-
* software distributed under the License is distributed on an
|
|
13
|
-
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
-
* KIND, either express or implied. See the License for the
|
|
15
|
-
* specific language governing permissions and limitations
|
|
16
|
-
* under the License.
|
|
17
|
-
*/
|
|
18
|
-
import { type Component } from 'vue';
|
|
19
|
-
/**
|
|
20
|
-
* Nuxt-specific OrganizationList container.
|
|
21
|
-
*
|
|
22
|
-
* Reads organization list context from `useOrganization()` (Nuxt auto-import)
|
|
23
|
-
* and delegates rendering to {@link BaseOrganizationList} from `@thunderid/vue`.
|
|
24
|
-
*
|
|
25
|
-
* Emits a `select` event with the chosen {@link IOrganization} before calling
|
|
26
|
-
* `switchOrganization` so consumers can handle custom post-switch logic.
|
|
27
|
-
*
|
|
28
|
-
* @example
|
|
29
|
-
* ```vue
|
|
30
|
-
* <ThunderIDOrganizationList @select="handleOrgSelect" />
|
|
31
|
-
* ```
|
|
32
|
-
*/
|
|
33
|
-
declare const OrganizationList: Component;
|
|
34
|
-
export default OrganizationList;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { withVendorCSSClassPrefix } from "@thunderid/browser";
|
|
2
|
-
import { BaseOrganizationList } from "@thunderid/vue";
|
|
3
|
-
import { defineComponent, h } from "vue";
|
|
4
|
-
import { useOrganization } from "#imports";
|
|
5
|
-
const OrganizationList = defineComponent({
|
|
6
|
-
emits: ["select"],
|
|
7
|
-
name: "OrganizationList",
|
|
8
|
-
props: {
|
|
9
|
-
className: { default: "", type: String }
|
|
10
|
-
},
|
|
11
|
-
setup(props, { slots, emit }) {
|
|
12
|
-
const { myOrganizations, isLoading, switchOrganization } = useOrganization();
|
|
13
|
-
const handleSelect = async (org) => {
|
|
14
|
-
emit("select", org);
|
|
15
|
-
await switchOrganization(org);
|
|
16
|
-
};
|
|
17
|
-
return () => h(
|
|
18
|
-
BaseOrganizationList,
|
|
19
|
-
{
|
|
20
|
-
class: withVendorCSSClassPrefix("organization-list--styled"),
|
|
21
|
-
className: props.className,
|
|
22
|
-
isLoading: isLoading?.value ?? false,
|
|
23
|
-
onSelect: handleSelect,
|
|
24
|
-
organizations: myOrganizations?.value ?? []
|
|
25
|
-
},
|
|
26
|
-
slots
|
|
27
|
-
);
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
export default OrganizationList;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
|
|
3
|
-
*
|
|
4
|
-
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
5
|
-
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
-
* in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing,
|
|
12
|
-
* software distributed under the License is distributed on an
|
|
13
|
-
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
-
* KIND, either express or implied. See the License for the
|
|
15
|
-
* specific language governing permissions and limitations
|
|
16
|
-
* under the License.
|
|
17
|
-
*/
|
|
18
|
-
import { type Component } from 'vue';
|
|
19
|
-
/**
|
|
20
|
-
* Nuxt-specific OrganizationProfile container.
|
|
21
|
-
*
|
|
22
|
-
* Reads the current organization from `useOrganization()` (Nuxt auto-import,
|
|
23
|
-
* re-exported from `@thunderid/vue`) and delegates rendering to
|
|
24
|
-
* {@link BaseOrganizationProfile} from `@thunderid/vue`.
|
|
25
|
-
*
|
|
26
|
-
* @example
|
|
27
|
-
* ```vue
|
|
28
|
-
* <ThunderIDOrganizationProfile :editable="true" />
|
|
29
|
-
* ```
|
|
30
|
-
*/
|
|
31
|
-
declare const OrganizationProfile: Component;
|
|
32
|
-
export default OrganizationProfile;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { withVendorCSSClassPrefix } from "@thunderid/browser";
|
|
2
|
-
import { BaseOrganizationProfile } from "@thunderid/vue";
|
|
3
|
-
import { defineComponent, h } from "vue";
|
|
4
|
-
import { useOrganization } from "#imports";
|
|
5
|
-
const OrganizationProfile = defineComponent({
|
|
6
|
-
name: "OrganizationProfile",
|
|
7
|
-
props: {
|
|
8
|
-
className: { default: "", type: String },
|
|
9
|
-
editable: { default: false, type: Boolean },
|
|
10
|
-
onUpdate: {
|
|
11
|
-
default: void 0,
|
|
12
|
-
type: Function
|
|
13
|
-
},
|
|
14
|
-
title: { default: "Organization Profile", type: String }
|
|
15
|
-
},
|
|
16
|
-
setup(props, { slots }) {
|
|
17
|
-
const { currentOrganization } = useOrganization();
|
|
18
|
-
return () => h(
|
|
19
|
-
BaseOrganizationProfile,
|
|
20
|
-
{
|
|
21
|
-
class: withVendorCSSClassPrefix("organization-profile--styled"),
|
|
22
|
-
className: props.className,
|
|
23
|
-
editable: props.editable,
|
|
24
|
-
onUpdate: props.onUpdate,
|
|
25
|
-
organization: currentOrganization?.value ?? null,
|
|
26
|
-
title: props.title
|
|
27
|
-
},
|
|
28
|
-
slots
|
|
29
|
-
);
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
export default OrganizationProfile;
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
|
|
3
|
-
*
|
|
4
|
-
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
5
|
-
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
-
* in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing,
|
|
12
|
-
* software distributed under the License is distributed on an
|
|
13
|
-
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
-
* KIND, either express or implied. See the License for the
|
|
15
|
-
* specific language governing permissions and limitations
|
|
16
|
-
* under the License.
|
|
17
|
-
*/
|
|
18
|
-
import { type Component } from 'vue';
|
|
19
|
-
/**
|
|
20
|
-
* Nuxt-specific OrganizationSwitcher container.
|
|
21
|
-
*
|
|
22
|
-
* Reads organization context from `useOrganization()` (Nuxt auto-import,
|
|
23
|
-
* re-exported from `@thunderid/vue`) and delegates rendering to
|
|
24
|
-
* {@link BaseOrganizationSwitcher} from `@thunderid/vue`.
|
|
25
|
-
*
|
|
26
|
-
* The `switchOrganization` action is provided by the OrganizationProvider
|
|
27
|
-
* context set up by {@link ThunderIDRoot}, which ultimately calls the Nitro
|
|
28
|
-
* `/api/auth/switch-org` route — no direct `window.location` usage.
|
|
29
|
-
*
|
|
30
|
-
* @example
|
|
31
|
-
* ```vue
|
|
32
|
-
* <ThunderIDOrganizationSwitcher />
|
|
33
|
-
* ```
|
|
34
|
-
*/
|
|
35
|
-
declare const OrganizationSwitcher: Component;
|
|
36
|
-
export default OrganizationSwitcher;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { withVendorCSSClassPrefix } from "@thunderid/browser";
|
|
2
|
-
import { BaseOrganizationSwitcher } from "@thunderid/vue";
|
|
3
|
-
import { defineComponent, h } from "vue";
|
|
4
|
-
import { useOrganization } from "#imports";
|
|
5
|
-
const OrganizationSwitcher = defineComponent({
|
|
6
|
-
name: "OrganizationSwitcher",
|
|
7
|
-
props: {
|
|
8
|
-
className: { default: "", type: String }
|
|
9
|
-
},
|
|
10
|
-
setup(props, { slots }) {
|
|
11
|
-
const { currentOrganization, myOrganizations, isLoading, switchOrganization } = useOrganization();
|
|
12
|
-
return () => h(
|
|
13
|
-
BaseOrganizationSwitcher,
|
|
14
|
-
{
|
|
15
|
-
class: withVendorCSSClassPrefix("organization-switcher--styled"),
|
|
16
|
-
className: props.className,
|
|
17
|
-
currentOrganization: currentOrganization?.value ?? null,
|
|
18
|
-
isLoading: isLoading?.value ?? false,
|
|
19
|
-
onSwitch: switchOrganization,
|
|
20
|
-
organizations: myOrganizations?.value ?? []
|
|
21
|
-
},
|
|
22
|
-
slots
|
|
23
|
-
);
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
export default OrganizationSwitcher;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
|
|
3
|
-
*
|
|
4
|
-
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
5
|
-
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
-
* in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing,
|
|
12
|
-
* software distributed under the License is distributed on an
|
|
13
|
-
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
-
* KIND, either express or implied. See the License for the
|
|
15
|
-
* specific language governing permissions and limitations
|
|
16
|
-
* under the License.
|
|
17
|
-
*/
|
|
18
|
-
import type { BrandingPreference } from '@thunderid/node';
|
|
19
|
-
/**
|
|
20
|
-
* GET /api/auth/branding
|
|
21
|
-
*
|
|
22
|
-
* Returns the branding preference for the current tenant / organisation context.
|
|
23
|
-
* Resolves the correct `baseUrl` (org-scoped if the session is inside an org).
|
|
24
|
-
* Does not require an authenticated session — unauthenticated callers receive
|
|
25
|
-
* the root-tenant branding.
|
|
26
|
-
*
|
|
27
|
-
* Used by `ThunderIDRoot.revalidateBranding` to refresh client-side branding
|
|
28
|
-
* state without a full page reload.
|
|
29
|
-
*/
|
|
30
|
-
declare const _default: import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<BrandingPreference | null>>;
|
|
31
|
-
export default _default;
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { defineEventHandler, createError } from "h3";
|
|
2
|
-
import ThunderIDNuxtClient from "../../../ThunderIDNuxtClient.js";
|
|
3
|
-
import { verifyAndRehydrateSession } from "../../../utils/serverSession.js";
|
|
4
|
-
import { useRuntimeConfig } from "#imports";
|
|
5
|
-
export default defineEventHandler(async (event) => {
|
|
6
|
-
const config = useRuntimeConfig(event);
|
|
7
|
-
const publicConfig = config.public.thunderid;
|
|
8
|
-
const sessionSecret = config.thunderid?.sessionSecret;
|
|
9
|
-
const baseUrl = publicConfig?.baseUrl ?? "";
|
|
10
|
-
let resolvedBaseUrl = baseUrl;
|
|
11
|
-
try {
|
|
12
|
-
const session = await verifyAndRehydrateSession(
|
|
13
|
-
event,
|
|
14
|
-
sessionSecret
|
|
15
|
-
);
|
|
16
|
-
if (session) {
|
|
17
|
-
if (session.organizationId) {
|
|
18
|
-
resolvedBaseUrl = `${baseUrl}/o`;
|
|
19
|
-
} else {
|
|
20
|
-
const client = ThunderIDNuxtClient.getInstance();
|
|
21
|
-
const idToken = await client.getDecodedIdToken(
|
|
22
|
-
session.sessionId
|
|
23
|
-
);
|
|
24
|
-
if (idToken?.user_org) {
|
|
25
|
-
resolvedBaseUrl = `${baseUrl}/o`;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
} catch {
|
|
30
|
-
}
|
|
31
|
-
try {
|
|
32
|
-
const client = ThunderIDNuxtClient.getInstance();
|
|
33
|
-
return await client.getBrandingPreference({ baseUrl: resolvedBaseUrl });
|
|
34
|
-
} catch (err) {
|
|
35
|
-
throw createError({
|
|
36
|
-
statusCode: 500,
|
|
37
|
-
statusMessage: `Failed to retrieve branding preference: ${err instanceof Error ? err.message : String(err)}`
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
});
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
|
|
3
|
-
*
|
|
4
|
-
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
5
|
-
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
-
* in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing,
|
|
12
|
-
* software distributed under the License is distributed on an
|
|
13
|
-
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
-
* KIND, either express or implied. See the License for the
|
|
15
|
-
* specific language governing permissions and limitations
|
|
16
|
-
* under the License.
|
|
17
|
-
*/
|
|
18
|
-
import type { Organization } from '@thunderid/node';
|
|
19
|
-
/**
|
|
20
|
-
* GET /api/auth/organizations/current
|
|
21
|
-
*
|
|
22
|
-
* Returns the organisation the authenticated user is currently acting within,
|
|
23
|
-
* derived from the session's ID token (`org_id` / `org_name` claims).
|
|
24
|
-
* Returns `null` when the user is not inside an organisation context.
|
|
25
|
-
*
|
|
26
|
-
* Used by `ThunderIDRoot.revalidateCurrentOrganization` callback.
|
|
27
|
-
*/
|
|
28
|
-
declare const _default: import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<Organization | null>>;
|
|
29
|
-
export default _default;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { defineEventHandler, createError } from "h3";
|
|
2
|
-
import ThunderIDNuxtClient from "../../../ThunderIDNuxtClient.js";
|
|
3
|
-
import { verifyAndRehydrateSession } from "../../../utils/serverSession.js";
|
|
4
|
-
import { useRuntimeConfig } from "#imports";
|
|
5
|
-
export default defineEventHandler(async (event) => {
|
|
6
|
-
const config = useRuntimeConfig();
|
|
7
|
-
const sessionSecret = config.thunderid?.sessionSecret;
|
|
8
|
-
const session = await verifyAndRehydrateSession(
|
|
9
|
-
event,
|
|
10
|
-
sessionSecret
|
|
11
|
-
);
|
|
12
|
-
if (!session) {
|
|
13
|
-
throw createError({ statusCode: 401, statusMessage: "Unauthorized: Invalid or expired session." });
|
|
14
|
-
}
|
|
15
|
-
try {
|
|
16
|
-
const client = ThunderIDNuxtClient.getInstance();
|
|
17
|
-
return await client.getCurrentOrganization(session.sessionId);
|
|
18
|
-
} catch (err) {
|
|
19
|
-
throw createError({
|
|
20
|
-
statusCode: 500,
|
|
21
|
-
statusMessage: `Failed to retrieve current organisation: ${err instanceof Error ? err.message : String(err)}`
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
});
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
|
|
3
|
-
*
|
|
4
|
-
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
5
|
-
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
-
* in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing,
|
|
12
|
-
* software distributed under the License is distributed on an
|
|
13
|
-
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
-
* KIND, either express or implied. See the License for the
|
|
15
|
-
* specific language governing permissions and limitations
|
|
16
|
-
* under the License.
|
|
17
|
-
*/
|
|
18
|
-
import type { OrganizationDetails } from '@thunderid/node';
|
|
19
|
-
/**
|
|
20
|
-
* GET /api/auth/organizations/:id
|
|
21
|
-
*
|
|
22
|
-
* Returns the details of a single organisation by its ID.
|
|
23
|
-
* Requires an active session.
|
|
24
|
-
*
|
|
25
|
-
* Mirrors `getOrganizationAction` in the Next.js SDK.
|
|
26
|
-
*/
|
|
27
|
-
declare const _default: import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<OrganizationDetails>>;
|
|
28
|
-
export default _default;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { defineEventHandler, getRouterParam, createError } from "h3";
|
|
2
|
-
import ThunderIDNuxtClient from "../../../ThunderIDNuxtClient.js";
|
|
3
|
-
import { verifyAndRehydrateSession } from "../../../utils/serverSession.js";
|
|
4
|
-
import { useRuntimeConfig } from "#imports";
|
|
5
|
-
export default defineEventHandler(async (event) => {
|
|
6
|
-
const config = useRuntimeConfig();
|
|
7
|
-
const sessionSecret = config.thunderid?.sessionSecret;
|
|
8
|
-
const session = await verifyAndRehydrateSession(
|
|
9
|
-
event,
|
|
10
|
-
sessionSecret
|
|
11
|
-
);
|
|
12
|
-
if (!session) {
|
|
13
|
-
throw createError({ statusCode: 401, statusMessage: "Unauthorized: Invalid or expired session." });
|
|
14
|
-
}
|
|
15
|
-
const organizationId = getRouterParam(event, "id");
|
|
16
|
-
if (!organizationId) {
|
|
17
|
-
throw createError({ statusCode: 400, statusMessage: "Organization ID is required." });
|
|
18
|
-
}
|
|
19
|
-
try {
|
|
20
|
-
const client = ThunderIDNuxtClient.getInstance();
|
|
21
|
-
return await client.getOrganization(organizationId, session.sessionId);
|
|
22
|
-
} catch (err) {
|
|
23
|
-
throw createError({
|
|
24
|
-
statusCode: 500,
|
|
25
|
-
statusMessage: `Failed to retrieve organisation: ${err instanceof Error ? err.message : String(err)}`
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
});
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
|
|
3
|
-
*
|
|
4
|
-
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
5
|
-
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
-
* in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing,
|
|
12
|
-
* software distributed under the License is distributed on an
|
|
13
|
-
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
-
* KIND, either express or implied. See the License for the
|
|
15
|
-
* specific language governing permissions and limitations
|
|
16
|
-
* under the License.
|
|
17
|
-
*/
|
|
18
|
-
import type { AllOrganizationsApiResponse } from '@thunderid/node';
|
|
19
|
-
/**
|
|
20
|
-
* GET /api/auth/organizations
|
|
21
|
-
*
|
|
22
|
-
* Returns all organisations accessible to the authenticated user (paginated).
|
|
23
|
-
* Used by `ThunderIDRoot.getAllOrganizations` callback.
|
|
24
|
-
*
|
|
25
|
-
* Mirrors `getAllOrganizations` server action in the Next.js SDK.
|
|
26
|
-
*/
|
|
27
|
-
declare const _default: import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<AllOrganizationsApiResponse>>;
|
|
28
|
-
export default _default;
|