Sha256: 8375232b997f12cfa175ec7aa9643cead8d3a35b9935e303bfc260d39fea2df5

Contents?: true

Size: 1.95 KB

Versions: 91

Compression:

Stored size: 1.95 KB

Contents

# frozen_string_literal: true

require 'securerandom'

# This component sets up the docker-test-saml-idp (https://github.com/kristophjunge/docker-test-saml-idp)
# image with the proper configuration for SAML integration.

module Gitlab
  module QA
    module Component
      class SAML < Base
        DOCKER_IMAGE = 'jamedjo/test-saml-idp'
        DOCKER_IMAGE_TAG = 'latest'

        def set_entity_id(entity_id)
          @environment['SIMPLESAMLPHP_SP_ENTITY_ID'] = entity_id
        end

        def set_assertion_consumer_service(assertion_con_service)
          @environment['SIMPLESAMLPHP_SP_ASSERTION_CONSUMER_SERVICE'] = assertion_con_service
        end

        def name
          @name ||= "saml-qa-idp"
        end

        def group_name
          @group_name ||= "saml_sso_group-#{SecureRandom.hex(4)}"
        end

        def instance
          raise 'Please provide a block!' unless block_given?

          super
        end

        # rubocop:disable Metrics/AbcSize
        def start
          docker.run(image: image, tag: tag) do |command|
            command << '-d '
            command << "--name #{name}"
            command << "--net #{network}"
            command << "--hostname #{hostname}"
            command << "--publish 8080:8080"
            command << "--publish 8443:8443"

            @volumes.to_h.each do |to, from|
              command.volume(to, from, 'Z')
            end

            @environment.to_h.each do |key, value|
              command.env(key, value)
            end

            @network_aliases.to_a.each do |network_alias|
              command << "--network-alias #{network_alias}"
            end
          end
        end
        # rubocop:enable Metrics/AbcSize

        def set_sandbox_name(sandbox_name)
          ::Gitlab::QA::Runtime::Env.gitlab_sandbox_name = sandbox_name
        end

        def set_simple_saml_hostname
          ::Gitlab::QA::Runtime::Env.simple_saml_hostname = hostname
        end
      end
    end
  end
end

Version data entries

91 entries across 91 versions & 1 rubygems

Version Path
gitlab-qa-15.2.0 lib/gitlab/qa/component/saml.rb
gitlab-qa-15.1.0 lib/gitlab/qa/component/saml.rb
gitlab-qa-15.0.0 lib/gitlab/qa/component/saml.rb
gitlab-qa-14.21.0 lib/gitlab/qa/component/saml.rb
gitlab-qa-14.20.0 lib/gitlab/qa/component/saml.rb
gitlab-qa-14.19.2 lib/gitlab/qa/component/saml.rb
gitlab-qa-14.19.1 lib/gitlab/qa/component/saml.rb
gitlab-qa-14.19.0 lib/gitlab/qa/component/saml.rb
gitlab-qa-14.18.0 lib/gitlab/qa/component/saml.rb
gitlab-qa-14.17.0 lib/gitlab/qa/component/saml.rb
gitlab-qa-14.16.0 lib/gitlab/qa/component/saml.rb
gitlab-qa-14.15.0 lib/gitlab/qa/component/saml.rb
gitlab-qa-14.14.0 lib/gitlab/qa/component/saml.rb
gitlab-qa-14.13.0 lib/gitlab/qa/component/saml.rb
gitlab-qa-14.12.0 lib/gitlab/qa/component/saml.rb
gitlab-qa-14.11.0 lib/gitlab/qa/component/saml.rb
gitlab-qa-14.9.0 lib/gitlab/qa/component/saml.rb
gitlab-qa-14.8.1 lib/gitlab/qa/component/saml.rb
gitlab-qa-14.8.0 lib/gitlab/qa/component/saml.rb
gitlab-qa-14.7.0 lib/gitlab/qa/component/saml.rb