MCPcopy Index your code
hub / github.com/simstudioai/sim / validateAll

Function validateAll

apps/sim/ee/sso/components/sso-settings.tsx:230–263  ·  view source on GitHub ↗
(data: typeof formData)

Source from the content-addressed store, hash-verified

228 }
229
230 const validateAll = (data: typeof formData) => {
231 const newErrors: Record<string, string[]> = {
232 providerType: [],
233 providerId: validateProviderId(data.providerId),
234 issuerUrl: validateIssuerUrl(data.issuerUrl),
235 domain: validateDomain(data.domain),
236 clientId: [],
237 clientSecret: [],
238 entryPoint: [],
239 cert: [],
240 scopes: [],
241 callbackUrl: [],
242 audience: [],
243 }
244
245 const providerType = data.providerType || 'oidc'
246
247 if (providerType === 'oidc') {
248 newErrors.clientId = validateRequired('Client ID', data.clientId)
249 newErrors.clientSecret = validateRequired('Client Secret', data.clientSecret)
250 if (!data.scopes || !data.scopes.trim()) {
251 newErrors.scopes = ['Scopes are required for OIDC providers']
252 }
253 } else if (providerType === 'saml') {
254 newErrors.entryPoint = validateIssuerUrl(data.entryPoint || '')
255 if (!newErrors.entryPoint.length && !data.entryPoint) {
256 newErrors.entryPoint = ['Entry Point URL is required for SAML providers']
257 }
258 newErrors.cert = validateRequired('Certificate', data.cert)
259 }
260
261 setErrors(newErrors)
262 return newErrors
263 }
264
265 const hasAnyErrors = (errs: Record<string, string[]>) =>
266 Object.values(errs).some((l) => l.length > 0)

Callers 2

handleSubmitFunction · 0.85
handleInputChangeFunction · 0.85

Calls 4

validateProviderIdFunction · 0.85
validateIssuerUrlFunction · 0.85
validateDomainFunction · 0.85
validateRequiredFunction · 0.85

Tested by

no test coverage detected