~ubuntu-branches/ubuntu/wily/puppet/wily

« back to all changes in this revision

Viewing changes to lib/puppet/network/http/api/v2/authorization.rb

  • Committer: Package Import Robot
  • Author(s): Stig Sandbeck Mathisen
  • Date: 2014-04-17 14:50:28 UTC
  • mfrom: (3.1.59 sid)
  • Revision ID: package-import@ubuntu.com-20140417145028-j3p3dwvp8ggpzvaf
Tags: 3.5.1-1
ImportedĀ upstreamĀ releaseĀ 3.5.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
class Puppet::Network::HTTP::API::V2::Authorization
 
2
  include Puppet::Network::Authorization
 
3
 
 
4
  def call(request, response)
 
5
    raise Puppet::Network::HTTP::Error::HTTPNotAuthorizedError, "Only GET requests are authorized for V2 endpoints" unless request.method == "GET"
 
6
 
 
7
    begin
 
8
      check_authorization(:find, request.path, request.params)
 
9
    rescue Puppet::Network::AuthorizationError => e
 
10
      raise Puppet::Network::HTTP::Error::HTTPNotAuthorizedError, e.message, e.backtrace
 
11
    end
 
12
  end
 
13
end