@meistrari/auth-nuxt 3.29.3 → 3.31.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.json +1 -1
- package/dist/runtime/composables/admin.d.ts +15 -1
- package/dist/runtime/composables/admin.js +8 -0
- package/dist/runtime/composables/session.js +4 -2
- package/dist/runtime/plugins/application-token-refresh.js +1 -1
- package/dist/runtime/server/routes/auth/callback.js +1 -5
- package/dist/runtime/server/routes/auth/refresh.js +1 -5
- package/dist/runtime/server/routes/auth/whoami.js +1 -1
- package/dist/runtime/shared.d.ts +7 -3
- package/dist/runtime/shared.js +1 -10
- package/package.json +2 -2
package/dist/module.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AdminApplicationRecord, AdminApplicationRole, AdminApplicationEntitlementRecord, AdminApplicationSecret, AdminEntitlementWithRules, AdminOrganization, AdminOrganizationSummary, AdminOrganizationTeamRecord, AdminUser, AdminUserAccess, CreateAdminApplicationEntitlementOptions, CreateAdminApplicationOptions, CreateAdminApplicationRoleOptions, CreateAdminApplicationSecretOptions, CreateAdminOrganizationOptions, CreateAdminOrganizationTeamOptions, CreatedAdminApplicationSecret, GetAdminOrganizationOptions, GetAdminOrganizationsSummaryOptions, InviteAdminOrganizationUsersOptions, InviteAdminOrganizationUsersResult, ListAdminApplicationsOptions, ListAdminApplicationsResult, ListAdminOrganizationMembersOptions, ListAdminOrganizationMembersResult, ListAdminOrganizationsOptions, ListAdminOrganizationsResult, ListAdminOrganizationTeamsOptions, ListAdminOrganizationTeamsResult, ListAdminUsersOptions, ListAdminUsersResult, AdminMember, RemoveAdminMemberOptions, ResendAdminInviteOptions, SetAdminEntitlementRulesOptions, SetAdminUserApplicationRoleOptions, SetAdminUserTeamOptions, UpdateAdminEntitlementOptions, UpdateAdminApplicationRoleOptions, UpdateAdminMemberRoleOptions, UpdateAdminOrganizationOptions } from '@meistrari/auth-core';
|
|
1
|
+
import type { AdminApplicationRecord, AdminApplicationRole, AdminApplicationEntitlementRecord, AdminApplicationSecret, AdminEntitlementWithRules, AdminOrganization, AdminOrganizationSummary, AdminOrganizationTeamRecord, AdminUser, AdminUserAccess, CreateAdminApplicationEntitlementOptions, CreateAdminApplicationOptions, CreateAdminApplicationRoleOptions, CreateAdminApplicationSecretOptions, CreateAdminOrganizationOptions, CreateAdminOrganizationTeamOptions, CreatedAdminApplicationSecret, GetAdminOrganizationOptions, GetAdminOrganizationsSummaryOptions, InviteAdminOrganizationUsersOptions, InviteAdminOrganizationUsersResult, ListAdminApplicationsOptions, ListAdminApplicationsResult, ListAdminOrganizationMembersOptions, ListAdminOrganizationMembersResult, ListAdminOrganizationsOptions, ListAdminOrganizationsResult, ListAdminOrganizationTeamsOptions, ListAdminOrganizationTeamsResult, ListAdminUsersOptions, ListAdminUsersResult, AdminMember, DeleteAdminOrganizationTeamOptions, RemoveAdminMemberOptions, ResendAdminInviteOptions, SetAdminEntitlementRulesOptions, SetAdminUserApplicationRoleOptions, SetAdminUserTeamOptions, UpdateAdminEntitlementOptions, UpdateAdminApplicationRoleOptions, UpdateAdminMemberRoleOptions, UpdateAdminOrganizationOptions, UpdateAdminOrganizationTeamOptions } from '@meistrari/auth-core';
|
|
2
2
|
export interface UseTelaAdminReturn {
|
|
3
3
|
/**
|
|
4
4
|
* Lists users, optionally with organization previews and totals when a
|
|
@@ -143,6 +143,20 @@ export interface UseTelaAdminReturn {
|
|
|
143
143
|
* @returns The created organization team
|
|
144
144
|
*/
|
|
145
145
|
createOrganizationTeam: (options: CreateAdminOrganizationTeamOptions) => Promise<AdminOrganizationTeamRecord>;
|
|
146
|
+
/**
|
|
147
|
+
* Updates a team for a single organization. Global admins may update any
|
|
148
|
+
* organization; an organization admin only their own.
|
|
149
|
+
* @param options - Organization ID, team ID, new name, and optional replacement member IDs
|
|
150
|
+
* @returns The updated organization team
|
|
151
|
+
*/
|
|
152
|
+
updateOrganizationTeam: (options: UpdateAdminOrganizationTeamOptions) => Promise<AdminOrganizationTeamRecord>;
|
|
153
|
+
/**
|
|
154
|
+
* Deletes a team for a single organization, detaching its members with it.
|
|
155
|
+
* Global admins may delete from any organization; an organization admin
|
|
156
|
+
* only from their own.
|
|
157
|
+
* @param options - Organization ID and team ID
|
|
158
|
+
*/
|
|
159
|
+
deleteOrganizationTeam: (options: DeleteAdminOrganizationTeamOptions) => Promise<void>;
|
|
146
160
|
/**
|
|
147
161
|
* Fetches the per-organization access report for a single user as a global
|
|
148
162
|
* admin, including organization roles, teams, and entitled applications with
|
|
@@ -63,6 +63,12 @@ export function useTelaAdmin() {
|
|
|
63
63
|
async function createOrganizationTeam(options) {
|
|
64
64
|
return await authClient.admin.createOrganizationTeam(options);
|
|
65
65
|
}
|
|
66
|
+
async function updateOrganizationTeam(options) {
|
|
67
|
+
return await authClient.admin.updateOrganizationTeam(options);
|
|
68
|
+
}
|
|
69
|
+
async function deleteOrganizationTeam(options) {
|
|
70
|
+
return await authClient.admin.deleteOrganizationTeam(options);
|
|
71
|
+
}
|
|
66
72
|
async function getUserAccess(userId) {
|
|
67
73
|
return await authClient.admin.getUserAccess(userId);
|
|
68
74
|
}
|
|
@@ -139,6 +145,8 @@ export function useTelaAdmin() {
|
|
|
139
145
|
listOrganizationMembers,
|
|
140
146
|
listOrganizationTeams,
|
|
141
147
|
createOrganizationTeam,
|
|
148
|
+
updateOrganizationTeam,
|
|
149
|
+
deleteOrganizationTeam,
|
|
142
150
|
getUserAccess,
|
|
143
151
|
createOrganization,
|
|
144
152
|
updateOrganization,
|
|
@@ -24,12 +24,14 @@ export function useTelaSession() {
|
|
|
24
24
|
async function signInWithSocialProvider({
|
|
25
25
|
provider,
|
|
26
26
|
callbackURL,
|
|
27
|
-
errorCallbackURL
|
|
27
|
+
errorCallbackURL,
|
|
28
|
+
loginHint
|
|
28
29
|
}) {
|
|
29
30
|
await authClient.session.signInWithSocialProvider({
|
|
30
31
|
provider,
|
|
31
32
|
callbackURL,
|
|
32
|
-
errorCallbackURL
|
|
33
|
+
errorCallbackURL,
|
|
34
|
+
loginHint
|
|
33
35
|
});
|
|
34
36
|
}
|
|
35
37
|
async function signInWithSaml({
|
|
@@ -53,7 +53,7 @@ export default defineNuxtPlugin({
|
|
|
53
53
|
}
|
|
54
54
|
console.error("[Tela Auth SDK] Transient token refresh failure during SSR, leaving session for client recovery:", error?.message);
|
|
55
55
|
};
|
|
56
|
-
const authClient = createNuxtAuthClient(appConfig.apiUrl, () => null
|
|
56
|
+
const authClient = createNuxtAuthClient(appConfig.apiUrl, () => null);
|
|
57
57
|
async function refreshOnServer() {
|
|
58
58
|
const { accessToken, refreshToken, user, organization, assurance } = await authClient.application.refreshAccessToken(refreshTokenCookie.value ?? "");
|
|
59
59
|
accessTokenCookie.value = accessToken;
|
|
@@ -18,11 +18,7 @@ export default defineEventHandler(async (event) => {
|
|
|
18
18
|
return await sendRedirect(event, `${loginPath}?error=verifier_missing`);
|
|
19
19
|
}
|
|
20
20
|
try {
|
|
21
|
-
const authClient = createNuxtAuthClient(
|
|
22
|
-
authConfig.apiUrl,
|
|
23
|
-
() => null,
|
|
24
|
-
() => null
|
|
25
|
-
);
|
|
21
|
+
const authClient = createNuxtAuthClient(authConfig.apiUrl, () => null);
|
|
26
22
|
const { accessToken, refreshToken } = await authClient.application.completeAuthorizationFlow(code, codeVerifier);
|
|
27
23
|
setCookie(event, "tela-access-token", accessToken, {
|
|
28
24
|
secure: !import.meta.dev,
|
|
@@ -14,11 +14,7 @@ export default defineEventHandler(async (event) => {
|
|
|
14
14
|
message: "No refresh token found"
|
|
15
15
|
});
|
|
16
16
|
}
|
|
17
|
-
const authClient = createNuxtAuthClient(
|
|
18
|
-
authConfig.apiUrl,
|
|
19
|
-
() => null,
|
|
20
|
-
() => refreshToken
|
|
21
|
-
);
|
|
17
|
+
const authClient = createNuxtAuthClient(authConfig.apiUrl, () => null);
|
|
22
18
|
let accessToken;
|
|
23
19
|
let newRefreshToken;
|
|
24
20
|
let user;
|
|
@@ -4,7 +4,7 @@ import { createNuxtAuthClient } from "../../../shared.js";
|
|
|
4
4
|
export default defineEventHandler(async (event) => {
|
|
5
5
|
const config = useRuntimeConfig();
|
|
6
6
|
const authConfig = config.public.telaAuth;
|
|
7
|
-
const authClient = createNuxtAuthClient(authConfig.apiUrl, () => null
|
|
7
|
+
const authClient = createNuxtAuthClient(authConfig.apiUrl, () => null);
|
|
8
8
|
const accessToken = getCookie(event, "tela-access-token");
|
|
9
9
|
if (!accessToken) {
|
|
10
10
|
throw createError({
|
package/dist/runtime/shared.d.ts
CHANGED
|
@@ -3,11 +3,15 @@ import { AuthClient } from '@meistrari/auth-core';
|
|
|
3
3
|
* Creates an {@link AuthClient} instance configured for use within a Nuxt application.
|
|
4
4
|
*
|
|
5
5
|
* Automatically sets the `X-User-Agent` header with SDK version and service name,
|
|
6
|
-
* and attaches authorization
|
|
6
|
+
* and attaches the authorization header to outgoing requests.
|
|
7
|
+
*
|
|
8
|
+
* Application tokens travel as `x-tela-access-token` / `x-tela-refresh-token`
|
|
9
|
+
* headers (set by the core client). They must never be sent as cookies: any
|
|
10
|
+
* `Cookie` header makes Better Auth's origin check demand a matching `Origin`,
|
|
11
|
+
* which server-to-server calls cannot provide.
|
|
7
12
|
*
|
|
8
13
|
* @param apiUrl - The base URL of the authentication API
|
|
9
14
|
* @param getAuthToken - Function that returns the current JWT access token, or `null` if not available
|
|
10
|
-
* @param getRefreshToken - Function that returns the current refresh token, or `null` if not available
|
|
11
15
|
* @returns A configured {@link AuthClient} instance
|
|
12
16
|
*/
|
|
13
|
-
export declare function createNuxtAuthClient(apiUrl: string, getAuthToken: () => string | null
|
|
17
|
+
export declare function createNuxtAuthClient(apiUrl: string, getAuthToken: () => string | null): AuthClient;
|
package/dist/runtime/shared.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AuthClient } from "@meistrari/auth-core";
|
|
2
2
|
import { version } from "../../package.json";
|
|
3
|
-
export function createNuxtAuthClient(apiUrl, getAuthToken
|
|
3
|
+
export function createNuxtAuthClient(apiUrl, getAuthToken) {
|
|
4
4
|
const serviceName = typeof process !== "undefined" ? process.env.SERVICE_NAME : "";
|
|
5
5
|
const userAgent = `auth-sdk:nuxt:${version}${serviceName ? `@${serviceName}` : ""}`;
|
|
6
6
|
return new AuthClient(apiUrl, {
|
|
@@ -14,15 +14,6 @@ export function createNuxtAuthClient(apiUrl, getAuthToken, getRefreshToken = ()
|
|
|
14
14
|
if (token && !isTokenRequest) {
|
|
15
15
|
context.headers.set("Authorization", `Bearer ${token}`);
|
|
16
16
|
}
|
|
17
|
-
const isRefreshTokenRequest = requestUrl.pathname.endsWith("/api/auth/applications/token/refresh");
|
|
18
|
-
if (isRefreshTokenRequest) {
|
|
19
|
-
const refreshToken = getRefreshToken();
|
|
20
|
-
if (refreshToken) {
|
|
21
|
-
const cookie = context.headers.get("Cookie");
|
|
22
|
-
const newCookie = cookie ? `${cookie}; tela-refresh-token=${refreshToken}` : `tela-refresh-token=${refreshToken}`;
|
|
23
|
-
context.headers.set("Cookie", newCookie);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
17
|
}
|
|
27
18
|
});
|
|
28
19
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@meistrari/auth-nuxt",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.31.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"docs": "nuxt-module-build prepare && typedoc"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@meistrari/auth-core": "1.
|
|
39
|
+
"@meistrari/auth-core": "1.41.1",
|
|
40
40
|
"jose": "6.1.3"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|