Sha256: a72ca23957b329e637e79c9e87c4b6ebea20dda38ee0a324b7831c52ce6fb7d8

Contents?: true

Size: 533 Bytes

Versions: 13

Compression:

Stored size: 533 Bytes

Contents

require 'certmeister/policy'

module Certmeister

  module Policy

    class ChainAll

      def initialize(policies)
        Certmeister::Policy.validate_policies(policies)
        @policies = policies
      end

      def authenticate(request)
        success = Certmeister::Policy::Response.new(true, nil)
        @policies.inject(success) do |continue, policy|
          response = policy.authenticate(request)
          break response unless response.authenticated?
          continue
        end
      end

    end

  end

end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
certmeister-2.3.2 lib/certmeister/policy/chain_all.rb
certmeister-2.3.1 lib/certmeister/policy/chain_all.rb
certmeister-2.3.0 lib/certmeister/policy/chain_all.rb
certmeister-2.2.0 lib/certmeister/policy/chain_all.rb
certmeister-2.1.0 lib/certmeister/policy/chain_all.rb
certmeister-2.0.0 lib/certmeister/policy/chain_all.rb
certmeister-1.2.1 lib/certmeister/policy/chain_all.rb
certmeister-1.2.0 lib/certmeister/policy/chain_all.rb
certmeister-1.1.0 lib/certmeister/policy/chain_all.rb
certmeister-1.0.1 lib/certmeister/policy/chain_all.rb
certmeister-1.0.0 lib/certmeister/policy/chain_all.rb
certmeister-0.4.1 lib/certmeister/policy/chain_all.rb
certmeister-0.4.0 lib/certmeister/policy/chain_all.rb