Sha256: fe55109cf9cbf186b87eea0cb977b87fc433a8a7c39124da5992df6f7d9bff06

Contents?: true

Size: 676 Bytes

Versions: 8

Compression:

Stored size: 676 Bytes

Contents

require "webmachine"
require "pact_broker/api/resources/authentication"

module PactBroker
  module Diagnostic
    module Resources
      class BaseResource < Webmachine::Resource

        include PactBroker::Api::Resources::Authentication

        def is_authorized?(authorization_header)
          authenticated?(self, authorization_header)
        end

        def forbidden?
          return false unless PactBroker.configuration.authorization_configured?
          !PactBroker.configuration.authorize.call(self, {})
        end

        def base_url
          request.env["pactbroker.base_url"] || request.base_uri.to_s.chomp("/")
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
pact_broker-2.112.0 lib/pact_broker/diagnostic/resources/base_resource.rb
pact_broker-2.111.0 lib/pact_broker/diagnostic/resources/base_resource.rb
pact_broker-2.109.1 lib/pact_broker/diagnostic/resources/base_resource.rb
pact_broker-2.109.0 lib/pact_broker/diagnostic/resources/base_resource.rb
pact_broker-2.108.0 lib/pact_broker/diagnostic/resources/base_resource.rb
pact_broker-2.107.1 lib/pact_broker/diagnostic/resources/base_resource.rb
pact_broker-2.107.0 lib/pact_broker/diagnostic/resources/base_resource.rb
pact_broker-2.107.0.beta.1 lib/pact_broker/diagnostic/resources/base_resource.rb