Sha256: ab5be9c0f98845094ce7f3ff50e74fd2f75edbc10cda94c6e9abb0a27f422315

Contents?: true

Size: 1.92 KB

Versions: 53

Compression:

Stored size: 1.92 KB

Contents

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'.freeze
        DOCKER_IMAGE_TAG = 'latest'.freeze

        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, 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

53 entries across 53 versions & 1 rubygems

Version Path
gitlab-qa-7.0.1 lib/gitlab/qa/component/saml.rb
gitlab-qa-7.0.0 lib/gitlab/qa/component/saml.rb
gitlab-qa-6.23.0 lib/gitlab/qa/component/saml.rb
gitlab-qa-6.22.1 lib/gitlab/qa/component/saml.rb
gitlab-qa-6.22.0 lib/gitlab/qa/component/saml.rb
gitlab-qa-6.21.4 lib/gitlab/qa/component/saml.rb
gitlab-qa-6.21.3 lib/gitlab/qa/component/saml.rb
gitlab-qa-6.21.2 lib/gitlab/qa/component/saml.rb
gitlab-qa-6.21.1 lib/gitlab/qa/component/saml.rb
gitlab-qa-6.21.0 lib/gitlab/qa/component/saml.rb
gitlab-qa-6.20.1 lib/gitlab/qa/component/saml.rb
gitlab-qa-6.20.0 lib/gitlab/qa/component/saml.rb
gitlab-qa-6.19.0 lib/gitlab/qa/component/saml.rb
gitlab-qa-6.18.2 lib/gitlab/qa/component/saml.rb
gitlab-qa-6.18.1 lib/gitlab/qa/component/saml.rb
gitlab-qa-6.18.0 lib/gitlab/qa/component/saml.rb
gitlab-qa-6.17.1 lib/gitlab/qa/component/saml.rb
gitlab-qa-6.17.0 lib/gitlab/qa/component/saml.rb
gitlab-qa-6.16.0 lib/gitlab/qa/component/saml.rb
gitlab-qa-6.15.4 lib/gitlab/qa/component/saml.rb