Class: Gitlab::Ci::Jwt

Inherits:
JwtBase show all
Defined in:
lib/gitlab/ci/jwt.rb

Direct Known Subclasses

JwtV2

Constant Summary collapse

NOT_BEFORE_TIME =
5
DEFAULT_EXPIRE_TIME =
60 * 5

Constants inherited from JwtBase

Gitlab::Ci::JwtBase::NoSigningKeyError

Constants inherited from JSONWebToken::Token

JSONWebToken::Token::DEFAULT_NOT_BEFORE_TIME

Instance Attribute Summary

Attributes inherited from JSONWebToken::Token

#audience, #expire_time, #id, #issued_at, #issuer, #not_before, #subject

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from JwtBase

decode, #encoded

Methods inherited from JSONWebToken::Token

#[], #[]=, #encoded, #payload

Constructor Details

#initialize(build, ttl:) ⇒ Jwt

Returns a new instance of Jwt.



13
14
15
16
17
18
# File 'lib/gitlab/ci/jwt.rb', line 13

def initialize(build, ttl:)
  super()

  @build = build
  @ttl = ttl
end

Class Method Details

.for_build(build) ⇒ Object



9
10
11
# File 'lib/gitlab/ci/jwt.rb', line 9

def self.for_build(build)
  self.new(build, ttl: build.).encoded
end