module Scalingo::JWT

Attributes

current_jwt[R]

Private Instance Methods

current_jwt_valid?() click to toggle source
# File lib/scalingo/jwt.rb, line 16
def current_jwt_valid?
  return false if @current_jwt.nil?

  ::JWT.decode @current_jwt, nil, false

  return true
rescue ::JWT::ExpiredSignature
  return false
end
exchange_token_jwt() click to toggle source
# File lib/scalingo/jwt.rb, line 26
def exchange_token_jwt
  jwt_connection = build_connection
  jwt_connection.basic_auth('', token)
  jwt_connection.url_prefix = auth_endpoint

  response = jwt_connection.post do |request|
    request.path = '/v1/tokens/exchange'
  end
  return response.body['token']
end