@krak-stack/auth 0.3.1 → 0.3.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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @krak-stack/auth
|
|
2
2
|
|
|
3
|
+
## 0.3.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Add English and French default messages to OAuthConsent, selected from the auth provider locale. Make messages optional and support partial overrides while preserving default labels for built-in permissions.
|
|
8
|
+
|
|
3
9
|
## 0.3.1
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
|
@@ -16,7 +16,7 @@ export type OAuthConsentMessages = {
|
|
|
16
16
|
};
|
|
17
17
|
/** Shared login-provider-aware consent. The signed OAuth query is sent intact;
|
|
18
18
|
* the provider, not the component, validates scopes, grants and callbacks. */
|
|
19
|
-
export declare const OAuthConsent: ({ messages, baseUrl: providedBaseUrl, }: {
|
|
20
|
-
readonly messages
|
|
19
|
+
export declare const OAuthConsent: ({ messages: overrides, baseUrl: providedBaseUrl, }: {
|
|
20
|
+
readonly messages?: Partial<OAuthConsentMessages>;
|
|
21
21
|
readonly baseUrl?: string;
|
|
22
22
|
}) => import("react").JSX.Element;
|
|
@@ -15,6 +15,62 @@ const ConsentSearch = Schema.Struct({
|
|
|
15
15
|
sig: Schema.NonEmptyString,
|
|
16
16
|
scope: Schema.optional(Schema.String),
|
|
17
17
|
}).annotate({ identifier: "OAuthConsentSearch" });
|
|
18
|
+
const defaultMessages = {
|
|
19
|
+
en: {
|
|
20
|
+
title: "Authorize application",
|
|
21
|
+
description: ({ clientName }) => `${clientName} is requesting access to your account.`,
|
|
22
|
+
requestedScopes: "Requested scopes",
|
|
23
|
+
allow: "Authorize",
|
|
24
|
+
deny: "Deny",
|
|
25
|
+
error: "Unable to save your decision. Please try again.",
|
|
26
|
+
invalidRequest: "This authorization request is invalid or incomplete. Start again from your application.",
|
|
27
|
+
notice: "Only connect applications you trust. You can revoke access later.",
|
|
28
|
+
permissions: {
|
|
29
|
+
"mcp:read": {
|
|
30
|
+
title: "Read application data",
|
|
31
|
+
description: "View information your account can access in your organization.",
|
|
32
|
+
},
|
|
33
|
+
"mcp:write": {
|
|
34
|
+
title: "Make changes on your behalf",
|
|
35
|
+
description: "Only actions your account is allowed to perform.",
|
|
36
|
+
},
|
|
37
|
+
offline_access: {
|
|
38
|
+
title: "Stay connected",
|
|
39
|
+
description: "Continue access without asking you to sign in each time, until access is revoked.",
|
|
40
|
+
},
|
|
41
|
+
openid: { title: "Verify your identity" },
|
|
42
|
+
profile: { title: "View your name and profile picture" },
|
|
43
|
+
email: { title: "View your email address" },
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
fr: {
|
|
47
|
+
title: "Autoriser l'application",
|
|
48
|
+
description: ({ clientName }) => `${clientName} demande l'accès à votre compte.`,
|
|
49
|
+
requestedScopes: "Portées demandées",
|
|
50
|
+
allow: "Autoriser",
|
|
51
|
+
deny: "Refuser",
|
|
52
|
+
error: "Impossible d'enregistrer votre décision. Veuillez réessayer.",
|
|
53
|
+
invalidRequest: "Cette demande d'autorisation est invalide ou incomplète. Recommencez depuis votre application.",
|
|
54
|
+
notice: "Connectez uniquement des applications de confiance. Vous pourrez révoquer l'accès plus tard.",
|
|
55
|
+
permissions: {
|
|
56
|
+
"mcp:read": {
|
|
57
|
+
title: "Lire les données de l'application",
|
|
58
|
+
description: "Consulter les informations accessibles à votre compte dans votre organisation.",
|
|
59
|
+
},
|
|
60
|
+
"mcp:write": {
|
|
61
|
+
title: "Effectuer des modifications en votre nom",
|
|
62
|
+
description: "Uniquement les actions autorisées pour votre compte.",
|
|
63
|
+
},
|
|
64
|
+
offline_access: {
|
|
65
|
+
title: "Rester connecté",
|
|
66
|
+
description: "Continuer l'accès sans vous demander de vous reconnecter à chaque fois, jusqu'à sa révocation.",
|
|
67
|
+
},
|
|
68
|
+
openid: { title: "Vérifier votre identité" },
|
|
69
|
+
profile: { title: "Consulter votre nom et votre photo de profil" },
|
|
70
|
+
email: { title: "Consulter votre adresse courriel" },
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
};
|
|
18
74
|
const scopeIcon = (scope) => {
|
|
19
75
|
switch (scope) {
|
|
20
76
|
case "mcp:read":
|
|
@@ -45,8 +101,14 @@ const makeConsentAtom = (baseUrl, search) => {
|
|
|
45
101
|
};
|
|
46
102
|
/** Shared login-provider-aware consent. The signed OAuth query is sent intact;
|
|
47
103
|
* the provider, not the component, validates scopes, grants and callbacks. */
|
|
48
|
-
export const OAuthConsent = ({ messages, baseUrl: providedBaseUrl, }) => {
|
|
104
|
+
export const OAuthConsent = ({ messages: overrides, baseUrl: providedBaseUrl, }) => {
|
|
49
105
|
const auth = useKrakstackAuth();
|
|
106
|
+
const defaults = defaultMessages[auth?.locale ?? "en"];
|
|
107
|
+
const messages = {
|
|
108
|
+
...defaults,
|
|
109
|
+
...overrides,
|
|
110
|
+
permissions: { ...defaults.permissions, ...overrides?.permissions },
|
|
111
|
+
};
|
|
50
112
|
const baseUrl = providedBaseUrl ?? auth?.baseUrl;
|
|
51
113
|
const search = useRouterState({
|
|
52
114
|
select: (state) => state.location.searchStr,
|