Sha256: c3a5de7ad34b816b1016e4c2e8fecf7ec3e3a5513ad9fc652cf24aadd2990be8

Contents?: true

Size: 620 Bytes

Versions: 1

Compression:

Stored size: 620 Bytes

Contents

module Rails
  module Auth
    module X509
      # Predicate matcher for making assertions about X.509 principals
      class Matcher
        # @option options [String] cn Common Name of the subject
        # @option options [String] ou Organizational Unit of the subject
        def initialize(options)
          @options = options
        end

        # @param [Hash] env Rack environment
        def match(env)
          principal = Rails::Auth.principals(env)["x509"]
          return false unless principal

          @options.all? { |name, value| principal[name] == value }
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rails-auth-0.0.1 lib/rails/auth/x509/matcher.rb