| 459 | // ============================================================ |
| 460 | |
| 461 | function ProviderConfigForm({ |
| 462 | providerType, |
| 463 | configForOAuth2, |
| 464 | configForOIDC, |
| 465 | configForLDAP, |
| 466 | scopesString, |
| 467 | onUpdateOAuth2, |
| 468 | onUpdateOIDC, |
| 469 | onUpdateLDAP, |
| 470 | onUpdateScopes, |
| 471 | }: { |
| 472 | providerType: IdentityProviderType; |
| 473 | configForOAuth2: OAuth2IdentityProviderConfig; |
| 474 | configForOIDC: OIDCIdentityProviderConfig; |
| 475 | configForLDAP: LDAPIdentityProviderConfig; |
| 476 | scopesString: string; |
| 477 | onUpdateOAuth2: (config: OAuth2IdentityProviderConfig) => void; |
| 478 | onUpdateOIDC: (config: OIDCIdentityProviderConfig) => void; |
| 479 | onUpdateLDAP: (config: LDAPIdentityProviderConfig) => void; |
| 480 | onUpdateScopes: (scopes: string) => void; |
| 481 | }) { |
| 482 | const { t } = useTranslation(); |
| 483 | |
| 484 | if (providerType === IdentityProviderType.OAUTH2) { |
| 485 | return ( |
| 486 | <div className="flex flex-col gap-y-6"> |
| 487 | <div className="grid grid-cols-1 md:grid-cols-2 gap-6"> |
| 488 | <div> |
| 489 | <label className="block text-base font-semibold text-gray-800 mb-2"> |
| 490 | Client ID <span className="text-error">*</span> |
| 491 | </label> |
| 492 | <Input |
| 493 | value={configForOAuth2.clientId} |
| 494 | onChange={(e) => |
| 495 | onUpdateOAuth2({ |
| 496 | ...configForOAuth2, |
| 497 | clientId: e.target.value, |
| 498 | }) |
| 499 | } |
| 500 | placeholder="e.g. 6655asd77895265aa110ac0d3" |
| 501 | /> |
| 502 | </div> |
| 503 | <div> |
| 504 | <label className="block text-base font-semibold text-gray-800 mb-2"> |
| 505 | Client Secret <span className="text-error">*</span> |
| 506 | </label> |
| 507 | <Input |
| 508 | type="password" |
| 509 | value={configForOAuth2.clientSecret} |
| 510 | onChange={(e) => |
| 511 | onUpdateOAuth2({ |
| 512 | ...configForOAuth2, |
| 513 | clientSecret: e.target.value, |
| 514 | }) |
| 515 | } |
| 516 | placeholder="e.g. 5bbezxc3972ca304de70c5d70a6aa932asd8" |
| 517 | /> |
| 518 | </div> |