Class: BoltServer::ACL::X509Matcher

Inherits:
Object
  • Object
show all
Defined in:
lib/bolt_server/acl.rb

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ X509Matcher

Returns a new instance of X509Matcher.



8
9
10
# File 'lib/bolt_server/acl.rb', line 8

def initialize(options)
  @options = options.freeze
end

Instance Method Details

#match(env) ⇒ Object



12
13
14
15
16
# File 'lib/bolt_server/acl.rb', line 12

def match(env)
  certificate = Rails::Auth::X509::Certificate.new(env['puma.peercert'])
  # This can be extended fairly easily to search OpenSSL::X509::Certificate#extensions for subjectAltNames.
  @options.all? { |name, value| certificate[name] == value }
end