Class: Gitlab::TerraformRegistryToken

Inherits:
JWTToken show all
Defined in:
lib/gitlab/terraform_registry_token.rb

Constant Summary

Constants inherited from JWTToken

JWTToken::HMAC_ALGORITHM, JWTToken::HMAC_EXPIRES_IN, JWTToken::HMAC_KEY

Constants inherited from JSONWebToken::HMACToken

JSONWebToken::HMACToken::IAT_LEEWAY, JSONWebToken::HMACToken::JWT_ALGORITHM

Constants inherited from JSONWebToken::Token

JSONWebToken::Token::DEFAULT_EXPIRE_TIME, 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

Methods inherited from JWTToken

#==, decode, #expire_time=, #initialize, #issued_at=, #not_before=, secret

Methods inherited from JSONWebToken::HMACToken

decode, #encoded, #initialize

Methods inherited from JSONWebToken::Token

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

Constructor Details

This class inherits a constructor from Gitlab::JWTToken

Class Method Details

.from_token(token) ⇒ Object


6
7
8
9
10
# File 'lib/gitlab/terraform_registry_token.rb', line 6

def from_token(token)
  new.tap do |terraform_registry_token|
    terraform_registry_token['token'] = token.try(:token).presence || token.try(:id).presence
  end
end