Sha256: a83caecc8514fce34f55da37d0dfa996e52b2d7509a0725394e1ed0cd7765b8f

Contents?: true

Size: 929 Bytes

Versions: 2

Compression:

Stored size: 929 Bytes

Contents

# frozen_string_literal: true

module Osso
  module GraphQL
    module Mutations
      class CreateIdentityProvider < BaseMutation
        null false
        argument :enterprise_account_id, ID, required: true
        argument :provider_service, Types::IdentityProviderService, required: true

        field :identity_provider, Types::IdentityProvider, null: false
        field :errors, [String], null: false

        def resolve(enterprise_account_id:, provider_service:)
          enterprise_account = Osso::Models::EnterpriseAccount.find(enterprise_account_id)
          identity_provider = enterprise_account.saml_providers.create!(
            provider: provider_service || 'OKTA',
            domain: enterprise_account.domain,
          )

          return_data(identity_provider: identity_provider)
        rescue StandardError => e
          return_error(errors: e.full_message)
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
osso-0.0.3.5 lib/osso/graphql/mutations/create_identity_provider.rb
osso-0.0.3.4 lib/osso/graphql/mutations/create_identity_provider.rb