in src/components/Auth/UserFormDialog/controls/CustomAttributes.tsx [26:47]
function validate(attributes: string) {
if (attributes === '') {
return true;
}
try {
// We're reusing server validation.
validateSerializedCustomClaims(attributes);
return true;
} catch (e) {
if (e.message === 'INVALID_CLAIMS') {
return 'Custom claims must be a valid JSON object';
}
if (e.message === 'CLAIMS_TOO_LARGE') {
return 'Custom claims length must not exceed 1000 characters';
}
const forbiddenClaim = e.message.match(/FORBIDDEN_CLAIM : (\w+)$/);
if (forbiddenClaim && forbiddenClaim[1]) {
return 'Custom claims must not have forbidden key: ' + forbiddenClaim[1];
}
}
}