class PkiExpress::TimestampAuthority

Attributes

auth_type[R]
basic_auth[R]
ssl_thumbprint[R]
token[R]
url[R]

Public Class Methods

new(url) click to toggle source
# File lib/pki_express/timestamp_authority.rb, line 5
def initialize(url)
  @url = url
  @auth_type = TsaAuthenticationType::NONE
  @token = nil
  @ssl_thumbprint = nil
  @basic_auth = nil
end

Public Instance Methods

get_cmd_arguments() click to toggle source
# File lib/pki_express/timestamp_authority.rb, line 28
def get_cmd_arguments
  args = []
  args.append('--tsa-url')
  args.append(url)

  case auth_type
  when TsaAuthenticationType::NONE
  when TsaAuthenticationType::BASIC_AUTH
    args.append('--tsa-basic-auth')
    args.append(@basic_auth)
  when TsaAuthenticationType::SSL
    args.append('--tsa-ssl-thumbprint')
    args.append(@ssl_thumbprint)
  when TsaAuthenticationType::OAUTH_TOKEN
    args.append('--tsa-token')
    args.append(token)
  else
    raise 'Unknown authentication type of the timestamp authority'
  end

  args
end
set_basic_authentication(username, password) click to toggle source
# File lib/pki_express/timestamp_authority.rb, line 18
def set_basic_authentication(username, password)
  @basic_auth = "#{username}:#{password}"
  @auth_type = TsaAuthenticationType::BASIC_AUTH
end
set_oauth_token_authentication(token) click to toggle source
# File lib/pki_express/timestamp_authority.rb, line 13
def set_oauth_token_authentication(token)
  @token = token
  @auth_type = TsaAuthenticationType::OAUTH_TOKEN
end
set_ssl_thumbprint(ssl_thumbprint) click to toggle source
# File lib/pki_express/timestamp_authority.rb, line 23
def set_ssl_thumbprint(ssl_thumbprint)
  @ssl_thumbprint = ssl_thumbprint
  @auth_type = TsaAuthenticationType::SSL
end