Sha256: 85a66388efde7c38e2ea225b78baf8219aef8dc986b6886c2621b16c7841008b

Contents?: true

Size: 1.02 KB

Versions: 3

Compression:

Stored size: 1.02 KB

Contents

require 'conjur/authn'
require 'conjur/command'

class Conjur::Command::Authn < Conjur::Command
  self.prefix = :authn
  
  desc "Logs in and caches credentials to netrc"
  long_desc <<-DESC
After successful login, subsequent commands automatically use the cached credentials. To switch users, login again using the new user credentials.
To erase credentials, use the authn:logout command.

If specified, the CAS server URL should be in the form https://<hostname>/v1.
It should be running the CAS RESTful services at the /v1 path
(or other path as specified by this argument).
DESC
  command :login do |c|
    c.arg_name 'username'
    c.flag [:u,:username]

    c.arg_name 'password'
    c.flag [:p,:password]

    c.arg_name 'CAS server'
    c.desc 'Specifies a CAS server URL to use for login'
    c.flag [:"cas-server"]
    
    c.action do |global_options,options,args|
      Conjur::Authn.login(options)
    end
  end
  
  desc "Logs out"
  command :logout do |c|
    c.action do
      Conjur::Authn.delete_credentials
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
conjur-cli-2.1.3 lib/conjur/command/authn.rb
conjur-cli-2.1.2 lib/conjur/command/authn.rb
conjur-cli-2.1.1 lib/conjur/command/authn.rb