Sha256: 2425b40c34d0a74a9e40615ae0e4b7314402bda37b6a1ccd25286afcbd7ab884

Contents?: true

Size: 552 Bytes

Versions: 1

Compression:

Stored size: 552 Bytes

Contents

require 'certmeister/policy'

module Certmeister

  module Policy

    class ChainAny

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

      def authenticate(request)
        failure = Certmeister::Policy::Response.new(false, "no conditions satisifed")
        @policies.inject(failure) do |continue, policy|
          response = policy.authenticate(request)
          break response if response.authenticated?
          continue
        end
      end

    end

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
certmeister-0.4.0 lib/certmeister/policy/chain_any.rb