Sha256: 805df80dbad3f2e57d5bf6f415575a31145ccac11c70cc6d2d84f92f10bb841f
Contents?: true
Size: 932 Bytes
Versions: 1
Compression:
Stored size: 932 Bytes
Contents
# frozen_string_literal: true module Rails module Auth module X509 # HTTPS principal identified by an X.509 client certificate class Principal attr_reader :certificate def initialize(certificate) unless certificate.is_a?(OpenSSL::X509::Certificate) fail TypeError, "expecting OpenSSL::X509::Certificate, got #{certificate.class}" end @certificate = certificate.freeze @subject = {} @certificate.subject.to_a.each do |name, data, _type| @subject[name.freeze] = data.freeze end @subject.freeze end def [](component) @subject[component.to_s.upcase] end def cn @subject["CN".freeze] end alias common_name cn def ou @subject["OU".freeze] end alias organizational_unit ou 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/principal.rb |