| 198 | } |
| 199 | |
| 200 | const validateIssuerUrl = (value: string): string[] => { |
| 201 | const out: string[] = [] |
| 202 | if (!value || !value.trim()) return ['Issuer URL is required.'] |
| 203 | try { |
| 204 | const url = new URL(value.trim()) |
| 205 | const isLocalhost = url.hostname === 'localhost' || url.hostname === '127.0.0.1' |
| 206 | if (url.protocol !== 'https:' && !isLocalhost) { |
| 207 | out.push('Issuer URL must use HTTPS.') |
| 208 | } |
| 209 | } catch { |
| 210 | out.push('Enter a valid issuer URL like https://your-identity-provider.com/oauth2/default') |
| 211 | } |
| 212 | return out |
| 213 | } |
| 214 | |
| 215 | const validateDomain = (value: string): string[] => { |
| 216 | const out: string[] = [] |