-
- {existingProvider.providerId}
-
+ const handleRemove = async () => {
+ if (!existingProvider) return
+ try {
+ await deleteSSOMutation.mutateAsync({ id: existingProvider.id, organizationId })
+ setShowRemoveConfirm(false)
+ setVerificationDetails(null)
+ toast.success('SSO provider removed')
+ } catch (error) {
+ toast.error(getErrorMessage(error, 'Failed to remove SSO provider'))
+ }
+ }
-
-
- {existingProvider.providerType.toUpperCase()}
-
-
+ const handleRequestVerification = async () => {
+ if (!existingProvider) return
+ try {
+ const result = await requestVerificationMutation.mutateAsync({
+ id: existingProvider.id,
+ organizationId,
+ })
+ setVerificationDetails({
+ recordName: result.recordName,
+ recordValue: result.recordValue,
+ })
+ } catch (error) {
+ toast.error(getErrorMessage(error, 'Failed to load DNS verification instructions'))
+ }
+ }
-
- {existingProvider.domain}
-
+ const handleVerifyDomain = async () => {
+ if (!existingProvider) return
+ try {
+ await verifyDomainMutation.mutateAsync({ id: existingProvider.id, organizationId })
+ toast.success('SSO domain verified')
+ } catch (error) {
+ toast.error(getErrorMessage(error, 'Domain verification failed'))
+ }
+ }
-
-
- {existingProvider.issuer}
-
-
+ if (existingProvider && !isEditing) {
+ const providerCallbackUrl = `${getBaseUrl()}/api/auth/${existingProvider.providerType === 'saml' ? 'sso/saml2/callback' : 'sso/callback'}/${existingProvider.providerId}`
+ const canConfigureProvider = !isBillingEnabled || hasEnterprisePlan
+ const actions: SettingsAction[] = [
+ ...(canConfigureProvider
+ ? [{ text: 'Edit', variant: 'primary' as const, onSelect: handleEdit }]
+ : []),
+ {
+ text: 'Remove',
+ variant: 'destructive',
+ onSelect: () => setShowRemoveConfirm(true),
+ },
+ ]
-
- copyToClipboard(providerCallbackUrl)}
- className='size-6 p-0 text-[var(--text-icon)] hover:text-[var(--text-primary)]'
- aria-label='Copy callback URL'
- >
- {copied ? (
-
- ) : (
-
- )}
-
- }
- />
-
- Configure this in your identity provider
-
-
-
-