Skip to content

Commit 7b5a7a6

Browse files
committed
add zod
1 parent 66a64f0 commit 7b5a7a6

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

clients/admin-ui/src/features/config-wizard/AuthenticateOktaForm.tsx

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,21 @@ const ValidationSchema = Yup.object().shape({
7373
.required()
7474
.trim()
7575
.label("Scopes")
76-
.default("okta.apps.read"),
76+
.default("okta.apps.read")
77+
.test(
78+
"valid-scopes",
79+
"Scopes must be a single scope or comma-separated list (e.g., 'okta.apps.read' or 'okta.apps.read, okta.users.read')",
80+
(value) => {
81+
if (!value) {
82+
return true;
83+
}
84+
// Split on comma and check each scope is non-empty and has no internal whitespace
85+
const scopes = value.split(",").map((s) => s.trim());
86+
return scopes.every(
87+
(scope) => scope.length > 0 && !/\s/.test(scope),
88+
);
89+
},
90+
),
7791
});
7892

7993
const AuthenticateOktaForm = () => {

0 commit comments

Comments
 (0)