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

unique_application_token.rb « token « doorkeeper_secret_storing « gitlab « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: e2ad2544b6c000225c07429d36853cf92e24bee0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# frozen_string_literal: true

module Gitlab
  module DoorkeeperSecretStoring
    module Token
      class UniqueApplicationToken
        # Acronym for 'GitLab OAuth Application Secret'
        OAUTH_APPLICATION_SECRET_PREFIX_FORMAT = "gloas-%{token}"

        # Maintains compatibility with ::Doorkeeper::OAuth::Helpers::UniqueToken
        # Returns a secure random token, prefixed with a GitLab identifier.
        def self.generate(*)
          format(OAUTH_APPLICATION_SECRET_PREFIX_FORMAT, token: SecureRandom.hex(32))
        end
      end
    end
  end
end