@asgardeo/nuxt 0.1.8 → 0.2.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/dist/module.d.mts +1 -0
- package/dist/module.json +1 -1
- package/dist/module.mjs +3 -1
- package/dist/runtime/server/AsgardeoNuxtClient.d.ts +4 -0
- package/dist/runtime/server/AsgardeoNuxtClient.js +19 -1
- package/dist/runtime/server/plugins/asgardeo-ssr.js +3 -1
- package/dist/runtime/server/routes/auth/user/profile.patch.js +8 -0
- package/dist/runtime/types.d.ts +18 -1
- package/package.json +4 -4
package/dist/module.d.mts
CHANGED
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -47,10 +47,12 @@ const module = defineNuxtModule({
|
|
|
47
47
|
applicationId: publicConfig.applicationId,
|
|
48
48
|
baseUrl: publicConfig.baseUrl,
|
|
49
49
|
clientId: publicConfig.clientId,
|
|
50
|
+
platform: publicConfig.platform,
|
|
50
51
|
preferences: publicConfig.preferences,
|
|
51
52
|
scopes: publicConfig.scopes,
|
|
52
53
|
signInUrl: publicConfig.signInUrl,
|
|
53
|
-
signUpUrl: publicConfig.signUpUrl
|
|
54
|
+
signUpUrl: publicConfig.signUpUrl,
|
|
55
|
+
tokenRequest: publicConfig.tokenRequest
|
|
54
56
|
}
|
|
55
57
|
);
|
|
56
58
|
const publicAsgardeo = options.runtimeConfig.public.asgardeo;
|
|
@@ -117,6 +117,10 @@ declare class AsgardeoNuxtClient extends AsgardeoNodeClient<AsgardeoNuxtConfig>
|
|
|
117
117
|
/**
|
|
118
118
|
* Clears the session and returns the RP-Initiated Logout URL.
|
|
119
119
|
* Accepts either `(sessionId: string)` or `(options?, sessionId?, callback?)`.
|
|
120
|
+
*
|
|
121
|
+
* For AsgardeoV2 (Thunder), RP-Initiated Logout is not yet supported by the platform.
|
|
122
|
+
* Skip the /oidc/logout call and return afterSignOutUrl directly — the caller
|
|
123
|
+
* (signout.post.ts) is responsible for clearing session cookies.
|
|
120
124
|
*/
|
|
121
125
|
signOut(...args: any[]): Promise<string>;
|
|
122
126
|
getUser(sessionId?: string): Promise<User>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AsgardeoNodeClient,
|
|
3
3
|
LegacyAsgardeoNodeClient,
|
|
4
|
+
Platform,
|
|
4
5
|
getBrandingPreference,
|
|
5
6
|
getMeOrganizations,
|
|
6
7
|
getAllOrganizations,
|
|
@@ -48,7 +49,9 @@ class AsgardeoNuxtClient extends AsgardeoNodeClient {
|
|
|
48
49
|
clientId: config.clientId,
|
|
49
50
|
clientSecret: config.clientSecret || void 0,
|
|
50
51
|
enablePKCE: true,
|
|
51
|
-
|
|
52
|
+
platform: config.platform,
|
|
53
|
+
scopes: config.scopes || ["openid", "profile"],
|
|
54
|
+
tokenRequest: config.tokenRequest
|
|
52
55
|
};
|
|
53
56
|
const result = await this.legacy.initialize(authConfig, storage);
|
|
54
57
|
this.isInitialized = true;
|
|
@@ -187,9 +190,17 @@ class AsgardeoNuxtClient extends AsgardeoNodeClient {
|
|
|
187
190
|
/**
|
|
188
191
|
* Clears the session and returns the RP-Initiated Logout URL.
|
|
189
192
|
* Accepts either `(sessionId: string)` or `(options?, sessionId?, callback?)`.
|
|
193
|
+
*
|
|
194
|
+
* For AsgardeoV2 (Thunder), RP-Initiated Logout is not yet supported by the platform.
|
|
195
|
+
* Skip the /oidc/logout call and return afterSignOutUrl directly — the caller
|
|
196
|
+
* (signout.post.ts) is responsible for clearing session cookies.
|
|
190
197
|
*/
|
|
191
198
|
async signOut(...args) {
|
|
192
199
|
const sessionId = typeof args[0] === "string" ? args[0] : args[1];
|
|
200
|
+
const configData = await this.legacy.getConfigData?.();
|
|
201
|
+
if (configData?.platform === Platform.AsgardeoV2) {
|
|
202
|
+
return configData?.afterSignOutUrl || configData?.afterSignInUrl || "/";
|
|
203
|
+
}
|
|
193
204
|
return this.legacy.signOut(sessionId);
|
|
194
205
|
}
|
|
195
206
|
getUser(sessionId) {
|
|
@@ -222,6 +233,10 @@ class AsgardeoNuxtClient extends AsgardeoNodeClient {
|
|
|
222
233
|
const accessToken = await this.getAccessToken(sessionId);
|
|
223
234
|
const configData = await this.legacy.getConfigData?.();
|
|
224
235
|
const baseUrl = configData?.baseUrl ?? "";
|
|
236
|
+
if (configData?.platform === Platform.AsgardeoV2) {
|
|
237
|
+
const user = await this.getUser(sessionId);
|
|
238
|
+
return { flattenedProfile: user, profile: user, schemas: [] };
|
|
239
|
+
}
|
|
225
240
|
try {
|
|
226
241
|
const authHeaders = { Authorization: `Bearer ${accessToken}` };
|
|
227
242
|
const [profile, schemas] = await Promise.all([
|
|
@@ -287,6 +302,9 @@ class AsgardeoNuxtClient extends AsgardeoNodeClient {
|
|
|
287
302
|
const accessToken = await this.getAccessToken(sessionId);
|
|
288
303
|
const configData = await this.legacy.getConfigData?.();
|
|
289
304
|
const baseUrl = configData?.baseUrl ?? "";
|
|
305
|
+
if (configData?.platform === Platform.AsgardeoV2) {
|
|
306
|
+
throw new Error("Profile updates are not supported for the AsgardeoV2 (Thunder) platform.");
|
|
307
|
+
}
|
|
290
308
|
return updateMeProfile({
|
|
291
309
|
...config,
|
|
292
310
|
// pass-through, includes payload
|
|
@@ -42,7 +42,9 @@ export default defineNitroPlugin((nitro) => {
|
|
|
42
42
|
baseUrl: publicConfig2.baseUrl,
|
|
43
43
|
clientId: publicConfig2.clientId,
|
|
44
44
|
clientSecret: privateConfig?.clientSecret || void 0,
|
|
45
|
-
|
|
45
|
+
platform: publicConfig2.platform,
|
|
46
|
+
scopes: publicConfig2.scopes || ["openid", "profile"],
|
|
47
|
+
tokenRequest: publicConfig2.tokenRequest
|
|
46
48
|
});
|
|
47
49
|
} catch (err) {
|
|
48
50
|
log.error("Failed to initialize Asgardeo client:", err);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Platform } from "@asgardeo/node";
|
|
1
2
|
import { defineEventHandler, readBody, createError } from "h3";
|
|
2
3
|
import AsgardeoNuxtClient from "../../../AsgardeoNuxtClient.js";
|
|
3
4
|
import { verifyAndRehydrateSession } from "../../../utils/serverSession.js";
|
|
@@ -6,6 +7,13 @@ export default defineEventHandler(
|
|
|
6
7
|
async (event) => {
|
|
7
8
|
const config = useRuntimeConfig();
|
|
8
9
|
const sessionSecret = config.asgardeo?.sessionSecret;
|
|
10
|
+
const publicConfig = config.public.asgardeo;
|
|
11
|
+
if (publicConfig?.platform === Platform.AsgardeoV2) {
|
|
12
|
+
throw createError({
|
|
13
|
+
statusCode: 501,
|
|
14
|
+
statusMessage: "Profile updates are not supported for the AsgardeoV2 (Thunder) platform."
|
|
15
|
+
});
|
|
16
|
+
}
|
|
9
17
|
const session = await verifyAndRehydrateSession(
|
|
10
18
|
event,
|
|
11
19
|
sessionSecret
|
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 { BrandingPreference, I18nPreferences, Organization, User, UserProfile } from '@asgardeo/node';
|
|
18
|
+
import type { BrandingPreference, I18nPreferences, Organization, Platform, TokenEndpointAuthMethod, User, UserProfile } from '@asgardeo/node';
|
|
19
19
|
import type { JWTPayload } from 'jose';
|
|
20
20
|
/**
|
|
21
21
|
* Configuration for the Asgardeo Nuxt module.
|
|
@@ -36,6 +36,12 @@ export interface AsgardeoNuxtConfig {
|
|
|
36
36
|
clientId?: string;
|
|
37
37
|
/** OAuth2 Client Secret (server-only, use ASGARDEO_CLIENT_SECRET env var) */
|
|
38
38
|
clientSecret?: string;
|
|
39
|
+
/**
|
|
40
|
+
* Identity platform variant. Set to `Platform.AsgardeoV2` when connecting to
|
|
41
|
+
* a Thunder (AsgardeoV2) instance. Forwarded to the underlying Node client so
|
|
42
|
+
* platform-specific behaviours (e.g. issuer resolution) apply correctly.
|
|
43
|
+
*/
|
|
44
|
+
platform?: keyof typeof Platform;
|
|
39
45
|
/**
|
|
40
46
|
* Feature-gating preferences that control which server-side data fetches
|
|
41
47
|
* the Nitro plugin performs on every SSR request.
|
|
@@ -81,6 +87,17 @@ export interface AsgardeoNuxtConfig {
|
|
|
81
87
|
* here instead of deriving the URL from `baseUrl`/`clientId`.
|
|
82
88
|
*/
|
|
83
89
|
signUpUrl?: string;
|
|
90
|
+
/**
|
|
91
|
+
* Configuration for the token endpoint request.
|
|
92
|
+
*/
|
|
93
|
+
tokenRequest?: {
|
|
94
|
+
/**
|
|
95
|
+
* OAuth 2.0 client authentication method used at the token endpoint.
|
|
96
|
+
* Defaults to `client_secret_basic` for AsgardeoV2 and `client_secret_post`
|
|
97
|
+
* for all other platforms when not specified.
|
|
98
|
+
*/
|
|
99
|
+
authMethod?: TokenEndpointAuthMethod;
|
|
100
|
+
};
|
|
84
101
|
}
|
|
85
102
|
/**
|
|
86
103
|
* Payload stored in the session JWT cookie.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@asgardeo/nuxt",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Nuxt module for Asgardeo - Authentication and Identity Management",
|
|
5
5
|
"author": "WSO2",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -70,9 +70,9 @@
|
|
|
70
70
|
"@nuxt/kit": "3.16.2",
|
|
71
71
|
"defu": "6.1.4",
|
|
72
72
|
"jose": "^6.0.11",
|
|
73
|
-
"@asgardeo/browser": "0.7.
|
|
74
|
-
"@asgardeo/node": "0.0.
|
|
75
|
-
"@asgardeo/vue": "0.
|
|
73
|
+
"@asgardeo/browser": "0.7.7",
|
|
74
|
+
"@asgardeo/node": "0.0.81",
|
|
75
|
+
"@asgardeo/vue": "0.4.0"
|
|
76
76
|
},
|
|
77
77
|
"peerDependencies": {
|
|
78
78
|
"nuxt": ">=3.10.0",
|