summaryrefslogtreecommitdiffstats
path: root/lib/puppet/network/rest_authorization.rb
blob: 0cf4472f12de1230ec0b82a8e9242619e6bd388c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
require 'puppet/network/client_request'
require 'puppet/network/rest_authconfig'

module Puppet::Network

    module RestAuthorization


        # Create our config object if necessary. If there's no configuration file
        # we install our defaults
        def authconfig
            unless defined?(@authconfig)
                @authconfig = Puppet::Network::RestAuthConfig.main
            end

            @authconfig
        end

        # Verify that our client has access.
        def check_authorization(request)
            authconfig.allowed?(request)
        end
    end
end