Sha256: 43968f5fb56e83145ad9ef24ebc637b36287247443f00ef3267f2f10e48f27f0

Contents?: true

Size: 1.15 KB

Versions: 510

Compression:

Stored size: 1.15 KB

Contents

require 'puppet/network/client_request'
require 'puppet/network/authconfig'
require 'puppet/network/auth_config_parser'

module Puppet::Network
  class AuthConfigLoader
    # Create our config object if necessary. If there's no configuration file
    # we install our defaults
    def self.authconfig
      @auth_config_file ||= Puppet::Util::WatchedFile.new(Puppet[:rest_authconfig])
      if (not @auth_config) or @auth_config_file.changed?
        begin
          @auth_config = Puppet::Network::AuthConfigParser.new_from_file(Puppet[:rest_authconfig]).parse
        rescue Errno::ENOENT, Errno::ENOTDIR
          @auth_config = Puppet::Network::AuthConfig.new
        end
      end

      @auth_config
    end
  end

  module Authorization
    @@authconfigloader_class = nil

    def self.authconfigloader_class=(klass)
      @@authconfigloader_class = klass
    end

    def authconfig
      authconfigloader = @@authconfigloader_class || AuthConfigLoader
      authconfigloader.authconfig
    end

    # Verify that our client has access.
    def check_authorization(method, path, params)
      authconfig.check_authorization(method, path, params)
    end
  end
end

Version data entries

510 entries across 510 versions & 3 rubygems

Version Path
puppet-6.29.0 lib/puppet/network/authorization.rb
puppet-6.29.0-x86-mingw32 lib/puppet/network/authorization.rb
puppet-6.29.0-x64-mingw32 lib/puppet/network/authorization.rb
puppet-6.29.0-universal-darwin lib/puppet/network/authorization.rb
puppet-6.28.0 lib/puppet/network/authorization.rb
puppet-6.28.0-x86-mingw32 lib/puppet/network/authorization.rb
puppet-6.28.0-x64-mingw32 lib/puppet/network/authorization.rb
puppet-6.28.0-universal-darwin lib/puppet/network/authorization.rb
puppet-6.27.0 lib/puppet/network/authorization.rb
puppet-6.27.0-x86-mingw32 lib/puppet/network/authorization.rb
puppet-6.27.0-x64-mingw32 lib/puppet/network/authorization.rb
puppet-6.27.0-universal-darwin lib/puppet/network/authorization.rb
puppet-6.26.0 lib/puppet/network/authorization.rb
puppet-6.26.0-x86-mingw32 lib/puppet/network/authorization.rb
puppet-6.26.0-x64-mingw32 lib/puppet/network/authorization.rb
puppet-6.26.0-universal-darwin lib/puppet/network/authorization.rb
puppet-6.25.1 lib/puppet/network/authorization.rb
puppet-6.25.1-x86-mingw32 lib/puppet/network/authorization.rb
puppet-6.25.1-x64-mingw32 lib/puppet/network/authorization.rb
puppet-6.25.1-universal-darwin lib/puppet/network/authorization.rb