Sha256: cc525d6c06e63d7c8ab963952de843500e8362e91abcb1004b186182ba94e6e8

Contents?: true

Size: 1.94 KB

Versions: 71

Compression:

Stored size: 1.94 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: 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

71 entries across 71 versions & 1 rubygems

Version Path
gitlab-qa-7.34.0 lib/gitlab/qa/component/saml.rb
gitlab-qa-7.33.0 lib/gitlab/qa/component/saml.rb
gitlab-qa-7.32.0 lib/gitlab/qa/component/saml.rb
gitlab-qa-7.31.0 lib/gitlab/qa/component/saml.rb
gitlab-qa-7.30.0 lib/gitlab/qa/component/saml.rb
gitlab-qa-7.29.1 lib/gitlab/qa/component/saml.rb
gitlab-qa-7.29.0 lib/gitlab/qa/component/saml.rb
gitlab-qa-7.27.2 lib/gitlab/qa/component/saml.rb
gitlab-qa-7.27.1 lib/gitlab/qa/component/saml.rb
gitlab-qa-7.27.0 lib/gitlab/qa/component/saml.rb
gitlab-qa-7.26.0 lib/gitlab/qa/component/saml.rb
gitlab-qa-7.25.1 lib/gitlab/qa/component/saml.rb
gitlab-qa-7.25.0 lib/gitlab/qa/component/saml.rb
gitlab-qa-7.24.6 lib/gitlab/qa/component/saml.rb
gitlab-qa-7.24.5 lib/gitlab/qa/component/saml.rb
gitlab-qa-7.24.4 lib/gitlab/qa/component/saml.rb
gitlab-qa-7.24.3 lib/gitlab/qa/component/saml.rb
gitlab-qa-7.24.2 lib/gitlab/qa/component/saml.rb
gitlab-qa-7.24.1 lib/gitlab/qa/component/saml.rb
gitlab-qa-7.24.0 lib/gitlab/qa/component/saml.rb