class Vcert::VenafiConnection

This class provides an easy way to configure and retrieve a connector for a Venafi platform. It supports the use of token authentication for TPP, and drops the use of user/password credentials. Usage: TPP:

VenafiConnection.new url: TPP_TOKEN_URL, user: TPPUSER, password: TPPPASSWORD, trust_bundle: TRUST_BUNDLE
VenafiConnection.new url: TPP_TOKEN_URL, access_token: TPP_ACCESS_TOKEN, trust_bundle: TRUST_BUNDLE
VenafiConnection.new url: TPP_TOKEN_URL, refresh_token: TPP_REFRESH_TOKEN, trust_bundle: TRUST_BUNDLE

CLoud:

VenafiConnection.new token: CLOUD_API_KEY

Public Class Methods

new(url: nil, access_token: nil, refresh_token: nil, user: nil, password: nil, apikey: nil, trust_bundle:nil, fake: false) click to toggle source
# File lib/vcert.rb, line 109
def initialize(url: nil, access_token: nil, refresh_token: nil, user: nil, password: nil, apikey: nil, trust_bundle:nil, fake: false)
  if fake
    @conn = FakeConnection.new
  elsif !apikey.nil?
    @conn = CloudConnection.new url, apikey
  elsif (!access_token.nil? || !refresh_token.nil? || (!user.nil? && !password.nil?)) && !url.nil?
    @conn = TokenConnection.new url, access_token: access_token, refresh_token: refresh_token, user: user,
                                password: password, trust_bundle: trust_bundle
  else
    raise ClientBadDataError, 'Invalid credentials list'
  end
end

Public Instance Methods

get_access_token(authentication: nil) click to toggle source

@param [Vcert::Authentication] authentication @return [Vcert::TokenInfo]

# File lib/vcert.rb, line 124
def get_access_token(authentication: nil)
  @conn.get_access_token authentication: authentication if @conn.is_a?(Vcert::TokenConnection)
end
refresh_access_token() click to toggle source

@return [Vcert::TokenInfo]

# File lib/vcert.rb, line 129
def refresh_access_token
  @conn.refresh_access_token if @conn.is_a?(Vcert::TokenConnection)
end
revoke_access_token() click to toggle source

@return []

# File lib/vcert.rb, line 134
def revoke_access_token
  @conn.revoke_access_token if @conn.is_a?(Vcert::TokenConnection)
end