Class: TransportACL::X509Matcher

Inherits:
Object
  • Object
show all
Defined in:
lib/bolt_ext/server_acl.rb

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ X509Matcher

Returns a new instance of X509Matcher.



7
8
9
# File 'lib/bolt_ext/server_acl.rb', line 7

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

Instance Method Details

#match(env) ⇒ Object



11
12
13
14
15
# File 'lib/bolt_ext/server_acl.rb', line 11

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