Sha256: 602cdb265a78129c43da9af4b539c35d700e670527ae337cf644e8a127e0725c

Contents?: true

Size: 1.27 KB

Versions: 11

Compression:

Stored size: 1.27 KB

Contents

# frozen_string_literal: true

require 'conjur/webservice'

module Conjur
  # API contains each of the methods for access the Conjur API endpoints
  #-- :reek:DataClump for authenticator identifier fields (name, id, account)
  class API
    # @!group Authenticators

    # List all configured authenticators
    def authenticator_list
      JSON.parse(url_for(:authenticators).get)
    end

    # Enables an authenticator in Conjur. The authenticator must be defined and
    # loaded in Conjur policy prior to enabling it.
    # 
    # @param [String] authenticator the authenticator type to enable (e.g. authn-k8s)
    # @param [String] id the service ID of the authenticator to enable
    def authenticator_enable authenticator, id, account: Conjur.configuration.account
      url_for(:authenticator, account, authenticator, id, credentials).patch(enabled: true)
    end

    # Disables an authenticator in Conjur.
    # 
    # @param [String] authenticator the authenticator type to disable (e.g. authn-k8s)
    # @param [String] id the service ID of the authenticator to disable
    def authenticator_disable authenticator, id, account: Conjur.configuration.account
      url_for(:authenticator, account, authenticator, id, credentials).patch(enabled: false)
    end

    # @!endgroup
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
conjur-api-5.3.8.pre.194 lib/conjur/api/authenticators.rb
conjur-api-5.3.7 lib/conjur/api/authenticators.rb
conjur-api-5.3.7.pre.183 lib/conjur/api/authenticators.rb
conjur-api-5.3.7.pre.168 lib/conjur/api/authenticators.rb
conjur-api-5.3.7.pre.14 lib/conjur/api/authenticators.rb
conjur-api-5.3.7.pre.167 lib/conjur/api/authenticators.rb
conjur-api-5.3.6 lib/conjur/api/authenticators.rb
conjur-api-5.3.5 lib/conjur/api/authenticators.rb
conjur-api-5.3.4 lib/conjur/api/authenticators.rb
conjur-api-5.3.3 lib/conjur/api/authenticators.rb
conjur-api-5.3.2 lib/conjur/api/authenticators.rb