Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gitlab/ci/jwt_v2/claim_mapper.rb')
-rw-r--r--lib/gitlab/ci/jwt_v2/claim_mapper.rb28
1 files changed, 28 insertions, 0 deletions
diff --git a/lib/gitlab/ci/jwt_v2/claim_mapper.rb b/lib/gitlab/ci/jwt_v2/claim_mapper.rb
new file mode 100644
index 00000000000..8e7f024d2d6
--- /dev/null
+++ b/lib/gitlab/ci/jwt_v2/claim_mapper.rb
@@ -0,0 +1,28 @@
+# frozen_string_literal: true
+
+module Gitlab
+ module Ci
+ class JwtV2
+ class ClaimMapper
+ MAPPER_FOR_CONFIG_SOURCE = {
+ repository_source: ClaimMapper::Repository
+ }.freeze
+
+ def initialize(project_config, pipeline)
+ return unless project_config
+
+ mapper_class = MAPPER_FOR_CONFIG_SOURCE[project_config.source]
+ @mapper = mapper_class&.new(project_config, pipeline)
+ end
+
+ def to_h
+ mapper&.to_h || {}
+ end
+
+ private
+
+ attr_reader :mapper
+ end
+ end
+ end
+end