Skip to content

TaskView is a self-hosted project and task management platform focused on clarity, ownership, and control. TaskView is built for teams that want a transparent, self-hosted alternative to SaaS task managers.

2.3 KB
Raw Blame
<template>
  <div class="flex flex-col gap-4">
    <UFormField :label="t('sso.protocol')">
      <USelect
        v-model="form.protocol"
        :items="protocolOptions"
        class="w-full"
        variant="soft"
        size="xl"
      />
    </UFormField>

    <UFormField :label="t('sso.displayName')">
      <UInput
        v-model="form.displayName"
        :placeholder="t('sso.displayNamePlaceholder')"
        class="w-full"
      />
    </UFormField>

    <UFormField :label="t('sso.emailDomain')">
      <UInput
        v-model="form.emailDomainRestriction"
        placeholder="company.com"
        class="w-full"
      />
    </UFormField>

    <SsoSamlForm
      v-if="form.protocol === 'saml'"
      v-model:form="form"
      :organization-id="organizationId"
      :callback-url-placeholder="callbackUrlPlaceholder"
      :has-secrets="hasSecrets"
    />

    <SsoOidcForm
      v-if="form.protocol === 'oidc'"
      v-model:form="form"
      :callback-url-placeholder="callbackUrlPlaceholder"
      :has-secrets="hasSecrets"
    />

    <div class="flex justify-end gap-2">
      <UButton
        :label="isEditing ? t('sso.save') : t('sso.create')"
        :loading="saving"
        variant="soft"
        @click="$emit('save')"
      />
      <UButton
        :label="t('sso.cancel')"
        variant="soft"
        color="neutral"
        @click="$emit('cancel')"
      />
    </div>
  </div>
</template>

<script setup lang="ts">
import { useI18n } from 'vue-i18n'
import SsoSamlForm from './SsoSamlForm.vue'
import SsoOidcForm from './SsoOidcForm.vue'

type SsoFormData = {
  protocol: 'saml' | 'oidc'
  displayName: string
  emailDomainRestriction: string
  samlEntryPoint: string
  samlIssuer: string
  samlCert: string
  samlCallbackUrl: string
  samlSigningKey: string
  samlSigningCert: string
  samlLogoutUrl: string
  oidcIssuer: string
  oidcClientId: string
  oidcClientSecret: string
  oidcCallbackUrl: string
}

const form = defineModel<SsoFormData>('form', { required: true })

import type { SsoConfig } from 'taskview-api'

defineProps<{
  organizationId: number
  isEditing: boolean
  saving: boolean
  callbackUrlPlaceholder: string
  hasSecrets?: SsoConfig
}>()

defineEmits<{
  save: []
  cancel: []
}>()

const { t } = useI18n()

const protocolOptions = [
  { label: 'SAML 2.0', value: 'saml' },
  { label: 'OpenID Connect', value: 'oidc' },
]
</script>