@schemavaults/auth-ui 0.26.1 → 0.27.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/README.md +9 -0
- package/dist/components/ConnectAppToApiDialog/ConnectAppToApiDialog.d.ts +2 -0
- package/dist/components/ConnectAppToApiDialog/ConnectAppToApiDialog.js +28 -6
- package/dist/components/ConnectAppToApiDialog/ConnectAppToApiDialog.js.map +1 -1
- package/dist/components/ConnectAppToApiDialog/first-party-option.d.ts +14 -0
- package/dist/components/ConnectAppToApiDialog/first-party-option.js +21 -0
- package/dist/components/ConnectAppToApiDialog/first-party-option.js.map +1 -0
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -11,6 +11,15 @@ Use the [Bun](https://bun.sh) package manager:
|
|
|
11
11
|
bun install
|
|
12
12
|
```
|
|
13
13
|
|
|
14
|
+
## `@schemavaults/ui` version
|
|
15
|
+
|
|
16
|
+
`@schemavaults/ui` is a peer dependency with a wide range (`>=0.125.0 <1.0.0`), so an
|
|
17
|
+
app can upgrade `@schemavaults/ui` without waiting for a new `@schemavaults/auth-ui`.
|
|
18
|
+
The pinned `devDependencies` entry is only the version this package is built and
|
|
19
|
+
tested against in the monorepo: when upgrading `@schemavaults/ui`, bump that entry and
|
|
20
|
+
leave the peer range alone. Raise the range's lower bound only when this package
|
|
21
|
+
starts using something a newer `@schemavaults/ui` added.
|
|
22
|
+
|
|
14
23
|
## Build package
|
|
15
24
|
```bash
|
|
16
25
|
bun run build
|
|
@@ -19,6 +19,8 @@ export interface ConnectAppToApiDialogProps {
|
|
|
19
19
|
onConnected?: (connection: {
|
|
20
20
|
api_server_id: string;
|
|
21
21
|
client_app_id: string;
|
|
22
|
+
/** Whether the connection was also marked first-party. */
|
|
23
|
+
first_party: boolean;
|
|
22
24
|
}) => void;
|
|
23
25
|
}
|
|
24
26
|
export declare function ConnectAppToApiDialog({ open, onOpenChange, preselectedApiServerId, preselectedClientAppId, onConnected, }: ConnectAppToApiDialogProps): ReactElement;
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { Button, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, Input, useToast, } from "@schemavaults/ui";
|
|
4
|
-
import { useEffect, useMemo } from "react";
|
|
3
|
+
import { Button, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, Input, Label, Switch, useToast, } from "@schemavaults/ui";
|
|
4
|
+
import { useEffect, useMemo, useState } from "react";
|
|
5
5
|
import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, useForm, } from "@schemavaults/ui";
|
|
6
|
-
import { useAppEnvironment, useAuth } from "@schemavaults/auth-react-provider";
|
|
6
|
+
import { useAdmin, useAppEnvironment, useAuth } from "@schemavaults/auth-react-provider";
|
|
7
7
|
import { appToApiPermissionSchema, } from "@schemavaults/app-definitions";
|
|
8
8
|
import { isAppAlreadyConnectedToApiServerError } from "@schemavaults/auth-common";
|
|
9
9
|
import { zodResolver } from "@hookform/resolvers/zod";
|
|
10
10
|
import { PlugZap } from "lucide-react";
|
|
11
11
|
import { useAuthUiFriendlyName } from "../FriendlyNameProvider";
|
|
12
|
+
import { canOfferFirstPartyConnection } from "./first-party-option";
|
|
13
|
+
const FIRST_PARTY_SWITCH_ID = "connect-app-to-api-first-party-switch";
|
|
12
14
|
export function ConnectAppToApiDialog({ open, onOpenChange, preselectedApiServerId, preselectedClientAppId, onConnected, }) {
|
|
13
15
|
const { toast } = useToast();
|
|
14
16
|
const friendlyName = useAuthUiFriendlyName();
|
|
@@ -23,6 +25,21 @@ export function ConnectAppToApiDialog({ open, onOpenChange, preselectedApiServer
|
|
|
23
25
|
});
|
|
24
26
|
const environment = useAppEnvironment();
|
|
25
27
|
const auth = useAuth();
|
|
28
|
+
// Marking a connection first-party waives every user's consent screen
|
|
29
|
+
// for it, which only platform administrators may do (the server refuses
|
|
30
|
+
// anyone else); hardcoded API servers define no API scopes to consent to.
|
|
31
|
+
const admin = useAdmin();
|
|
32
|
+
const apiServerIdValue = form.watch("api_server_id") ?? "";
|
|
33
|
+
const canMarkFirstParty = canOfferFirstPartyConnection(admin, apiServerIdValue);
|
|
34
|
+
const [firstParty, setFirstParty] = useState(false);
|
|
35
|
+
// Every opening starts with the switch off (the dialog stays mounted
|
|
36
|
+
// between openings in the tables that host it).
|
|
37
|
+
const [wasOpen, setWasOpen] = useState(open);
|
|
38
|
+
if (open !== wasOpen) {
|
|
39
|
+
setWasOpen(open);
|
|
40
|
+
if (open)
|
|
41
|
+
setFirstParty(false);
|
|
42
|
+
}
|
|
26
43
|
useEffect(() => {
|
|
27
44
|
if (open && (preselectedApiServerId || preselectedClientAppId)) {
|
|
28
45
|
form.reset(defaultValues);
|
|
@@ -42,12 +59,13 @@ export function ConnectAppToApiDialog({ open, onOpenChange, preselectedApiServer
|
|
|
42
59
|
title: "Submitting App-to-API Permission creation form...",
|
|
43
60
|
});
|
|
44
61
|
}
|
|
62
|
+
const first_party = firstParty && canOfferFirstPartyConnection(admin, values.api_server_id);
|
|
45
63
|
try {
|
|
46
64
|
const authClient = auth.ready ? auth.client.current : undefined;
|
|
47
65
|
if (!authClient) {
|
|
48
66
|
throw new Error("Auth client is not available");
|
|
49
67
|
}
|
|
50
|
-
await authClient.connectAppToApiServer(values.api_server_id, values.client_app_id);
|
|
68
|
+
await authClient.connectAppToApiServer(values.api_server_id, values.client_app_id, first_party ? { first_party: true } : undefined);
|
|
51
69
|
}
|
|
52
70
|
catch (e) {
|
|
53
71
|
if (isAppAlreadyConnectedToApiServerError(e)) {
|
|
@@ -68,13 +86,17 @@ export function ConnectAppToApiDialog({ open, onOpenChange, preselectedApiServer
|
|
|
68
86
|
toast({
|
|
69
87
|
variant: "default",
|
|
70
88
|
title: "Connected app to API server successfully!",
|
|
71
|
-
description:
|
|
89
|
+
description: first_party
|
|
90
|
+
? "It can now send the API server authenticated requests. First-party connection: its users consent implicitly."
|
|
91
|
+
: "It can now send the API server authenticated requests.",
|
|
72
92
|
});
|
|
73
93
|
onConnected?.({
|
|
74
94
|
api_server_id: values.api_server_id,
|
|
75
95
|
client_app_id: values.client_app_id,
|
|
96
|
+
first_party,
|
|
76
97
|
});
|
|
77
98
|
form.reset();
|
|
99
|
+
setFirstParty(false);
|
|
78
100
|
onOpenChange(false);
|
|
79
101
|
return;
|
|
80
102
|
}
|
|
@@ -91,7 +113,7 @@ export function ConnectAppToApiDialog({ open, onOpenChange, preselectedApiServer
|
|
|
91
113
|
? "Client app ID is pre-selected."
|
|
92
114
|
: "Enter the UUID of the frontend client application." }), _jsx(FormMessage, {})] })) }), _jsx(FormField, { control: form.control, name: "api_server_id", render: ({ field }) => (_jsxs(FormItem, { children: [_jsx(FormLabel, { children: "API Server ID" }), _jsx(FormControl, { children: _jsx(Input, { placeholder: "fcf06e2d-fa7f-45bf-875f-9ca5384618c9", ...field, disabled: !!preselectedApiServerId, readOnly: !!preselectedApiServerId }) }), _jsx(FormDescription, { children: preselectedApiServerId
|
|
93
115
|
? "API server ID is pre-selected."
|
|
94
|
-
: "Enter the UUID of the API server application." }), _jsx(FormMessage, {})] })) }), _jsx(DialogFooter, { children: _jsxs(Button, { type: "submit", children: [_jsx(PlugZap, { className: "h-4 w-4 mr-2" }), "Connect app to API server"] }) })] }) }) }) }));
|
|
116
|
+
: "Enter the UUID of the API server application." }), _jsx(FormMessage, {})] })) }), canMarkFirstParty && (_jsxs("div", { className: "flex flex-row items-start justify-between gap-4 rounded-md border p-3", children: [_jsxs("div", { className: "space-y-1", children: [_jsx(Label, { htmlFor: FIRST_PARTY_SWITCH_ID, className: "font-medium", children: "First-party connection" }), _jsx("p", { className: "text-sm text-muted-foreground", children: "The app and the API server belong to the same party: users signing in to the app for this API server consent implicitly, without the consent screen. Platform administrators only; it can be changed later from the API server's scope allowances." })] }), _jsx(Switch, { id: FIRST_PARTY_SWITCH_ID, checked: firstParty, disabled: form.formState.isSubmitting, onCheckedChange: (checked) => setFirstParty(checked), "data-testid": FIRST_PARTY_SWITCH_ID })] })), _jsx(DialogFooter, { children: _jsxs(Button, { type: "submit", children: [_jsx(PlugZap, { className: "h-4 w-4 mr-2" }), "Connect app to API server"] }) })] }) }) }) }));
|
|
95
117
|
}
|
|
96
118
|
export function ConnectAppToApiDialogTrigger({ onOpenChange, }) {
|
|
97
119
|
return (_jsxs(Button, { id: "connect-app-to-api-dialog-trigger-button", onClick: (e) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConnectAppToApiDialog.js","sourceRoot":"","sources":["../../../src/components/ConnectAppToApiDialog/ConnectAppToApiDialog.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EACL,MAAM,EACN,IAAI,EACJ,WAAW,EACX,eAAe,EACf,SAAS,EACT,QAAQ,EACR,SAAS,EACT,WAAW,EACX,KAAK,EACL,QAAQ,GACT,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAqB,SAAS,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"ConnectAppToApiDialog.js","sourceRoot":"","sources":["../../../src/components/ConnectAppToApiDialog/ConnectAppToApiDialog.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EACL,MAAM,EACN,IAAI,EACJ,WAAW,EACX,eAAe,EACf,SAAS,EACT,QAAQ,EACR,SAAS,EACT,WAAW,EACX,KAAK,EACL,KAAK,EACL,MAAM,EACN,QAAQ,GACT,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAqB,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAExE,OAAO,EACL,MAAM,EACN,aAAa,EACb,iBAAiB,EACjB,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,OAAO,GACR,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,QAAQ,EAAE,iBAAiB,EAAE,OAAO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AAsB,GAClC,GACU,EACd,KAAC,eAAe,cACb,sBAAsB;4CACrB,CAAC,CAAC,gCAAgC;4CAClC,CAAC,CAAC,+CAA+C,GACnC,EAClB,KAAC,WAAW,KAAG,IACN,CACZ,GACD,EAED,iBAAiB,IAAI,CACpB,eAAK,SAAS,EAAC,uEAAuE,aACpF,eAAK,SAAS,EAAC,WAAW,aACxB,KAAC,KAAK,IAAC,OAAO,EAAE,qBAAqB,EAAE,SAAS,EAAC,aAAa,uCAEtD,EACR,YAAG,SAAS,EAAC,+BAA+B,mQAMxC,IACA,EACN,KAAC,MAAM,IACL,EAAE,EAAE,qBAAqB,EACzB,OAAO,EAAE,UAAU,EACnB,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,YAAY,EACrC,eAAe,EAAE,CAAC,OAAgB,EAAE,EAAE,CAAC,aAAa,CAAC,OAAO,CAAC,iBAChD,qBAAqB,GAClC,IACE,CACP,EAED,KAAC,YAAY,cACX,MAAC,MAAM,IAAC,IAAI,EAAC,QAAQ,aACnB,KAAC,OAAO,IAAC,SAAS,EAAC,cAAc,GAAG,iCAE7B,GACI,IACV,GACF,GACO,GACT,CACV,CAAC;AACJ,CAAC;AAMD,MAAM,UAAU,4BAA4B,CAAC,EAC3C,YAAY,GACsB;IAClC,OAAO,CACL,MAAC,MAAM,IACL,EAAE,EAAC,0CAA0C,EAC7C,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE;YACb,CAAC,CAAC,cAAc,EAAE,CAAC;YACnB,YAAY,CAAC,IAAI,CAAC,CAAC;QACrB,CAAC,aAED,KAAC,OAAO,IAAC,SAAS,EAAC,cAAc,GAAG,2BAC7B,CACV,CAAC;AACJ,CAAC;AAED,eAAe,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether the connect dialog offers to mark the new connection first-party
|
|
3
|
+
* for the API server id its field holds: only to platform administrators
|
|
4
|
+
* (the server refuses anyone else), and never for a hardcoded API server
|
|
5
|
+
* (they define no API scopes to consent to; the server refuses those too).
|
|
6
|
+
*
|
|
7
|
+
* The field holds whatever is typed so far, which `isHardcodedApiServerId()`
|
|
8
|
+
* refuses (it throws) until it is a well-formed id: until then it names no
|
|
9
|
+
* hardcoded API server. Client bundles resolve the auth server's own app id
|
|
10
|
+
* to its default, so a white-label deployment's own API server id is only
|
|
11
|
+
* refused by the server (400, shown in the dialog's error toast).
|
|
12
|
+
*/
|
|
13
|
+
export declare function canOfferFirstPartyConnection(admin: boolean, api_server_id: string): boolean;
|
|
14
|
+
export default canOfferFirstPartyConnection;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { isHardcodedApiServerId, isValidApiServerId, } from "@schemavaults/app-definitions";
|
|
2
|
+
/**
|
|
3
|
+
* Whether the connect dialog offers to mark the new connection first-party
|
|
4
|
+
* for the API server id its field holds: only to platform administrators
|
|
5
|
+
* (the server refuses anyone else), and never for a hardcoded API server
|
|
6
|
+
* (they define no API scopes to consent to; the server refuses those too).
|
|
7
|
+
*
|
|
8
|
+
* The field holds whatever is typed so far, which `isHardcodedApiServerId()`
|
|
9
|
+
* refuses (it throws) until it is a well-formed id: until then it names no
|
|
10
|
+
* hardcoded API server. Client bundles resolve the auth server's own app id
|
|
11
|
+
* to its default, so a white-label deployment's own API server id is only
|
|
12
|
+
* refused by the server (400, shown in the dialog's error toast).
|
|
13
|
+
*/
|
|
14
|
+
export function canOfferFirstPartyConnection(admin, api_server_id) {
|
|
15
|
+
if (!admin)
|
|
16
|
+
return false;
|
|
17
|
+
const id = api_server_id.trim();
|
|
18
|
+
return !(isValidApiServerId(id) && isHardcodedApiServerId(id));
|
|
19
|
+
}
|
|
20
|
+
export default canOfferFirstPartyConnection;
|
|
21
|
+
//# sourceMappingURL=first-party-option.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"first-party-option.js","sourceRoot":"","sources":["../../../src/components/ConnectAppToApiDialog/first-party-option.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EACtB,kBAAkB,GACnB,MAAM,+BAA+B,CAAC;AAEvC;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,4BAA4B,CAC1C,KAAc,EACd,aAAqB;IAErB,IAAI,CAAC,KAAK;QAAE,OAAO,KAAK,CAAC;IACzB,MAAM,EAAE,GAAW,aAAa,CAAC,IAAI,EAAE,CAAC;IACxC,OAAO,CAAC,CAAC,kBAAkB,CAAC,EAAE,CAAC,IAAI,sBAAsB,CAAC,EAAE,CAAC,CAAC,CAAC;AACjE,CAAC;AAED,eAAe,4BAA4B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@schemavaults/auth-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.27.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"description": "React.js UI components for authentication/authorization shared between different SchemaVaults apps",
|
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
"react": "^19.3.1",
|
|
17
17
|
"react-dom": "^19.3.1",
|
|
18
18
|
"next": "^16.4.6",
|
|
19
|
-
"@schemavaults/ui": "
|
|
20
|
-
"@schemavaults/auth-react-provider": "0.20.
|
|
19
|
+
"@schemavaults/ui": ">=0.125.0 <1.0.0",
|
|
20
|
+
"@schemavaults/auth-react-provider": "0.20.11",
|
|
21
21
|
"@schemavaults/app-definitions": "0.18.2",
|
|
22
22
|
"@schemavaults/auth-common": "0.41.3",
|
|
23
23
|
"lucide-react": "0.575.0",
|
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
"tailwindcss": "3.4.17"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
+
"@schemavaults/ui": "0.125.0",
|
|
29
30
|
"typescript": "6.0.3",
|
|
30
31
|
"tsc-alias": "1.9.0",
|
|
31
32
|
"@types/react": "19.3.0",
|