Sha256: fd0fe85e65856760a9dbb8766fcf6d45db32e52a8fbb9fbf73c56a28c02ac81a

Contents?: true

Size: 975 Bytes

Versions: 89

Compression:

Stored size: 975 Bytes

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
    def authconfig
      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

89 entries across 89 versions & 2 rubygems

Version Path
puppet-retrospec-0.12.2 vendor/gems/puppet-3.7.3/lib/puppet/network/authorization.rb
puppet-3.8.7 lib/puppet/network/authorization.rb
puppet-3.8.7-x86-mingw32 lib/puppet/network/authorization.rb
puppet-3.8.7-x64-mingw32 lib/puppet/network/authorization.rb
puppet-3.8.6 lib/puppet/network/authorization.rb
puppet-3.8.6-x86-mingw32 lib/puppet/network/authorization.rb
puppet-retrospec-0.12.1 vendor/gems/puppet-3.7.3/lib/puppet/network/authorization.rb
puppet-3.8.6-x64-mingw32 lib/puppet/network/authorization.rb
puppet-retrospec-0.12.0 vendor/gems/puppet-3.7.3/lib/puppet/network/authorization.rb
puppet-3.8.5 lib/puppet/network/authorization.rb
puppet-3.8.5-x86-mingw32 lib/puppet/network/authorization.rb
puppet-3.8.5-x64-mingw32 lib/puppet/network/authorization.rb
puppet-3.8.4 lib/puppet/network/authorization.rb
puppet-3.8.4-x86-mingw32 lib/puppet/network/authorization.rb
puppet-3.8.4-x64-mingw32 lib/puppet/network/authorization.rb
puppet-4.2.3 lib/puppet/network/authorization.rb
puppet-4.2.3-x86-mingw32 lib/puppet/network/authorization.rb
puppet-4.2.3-x64-mingw32 lib/puppet/network/authorization.rb
puppet-retrospec-0.11.0 vendor/gems/puppet-3.7.3/lib/puppet/network/authorization.rb
puppet-retrospec-0.10.0 vendor/gems/puppet-3.7.3/lib/puppet/network/authorization.rb