Sha256: e3398d983464580c025cb9c506fa740ce3f76379f7bb591521538867c9d741e4

Contents?: true

Size: 574 Bytes

Versions: 10

Compression:

Stored size: 574 Bytes

Contents

require "java"
require "stringio"

module Rails
  module Auth
    module X509
      module Filter
        # Extract OpenSSL::X509::Certificates from Java's sun.security.x509.X509CertImpl
        class Java
          def call(certs)
            return unless certs
            OpenSSL::X509::Certificate.new(extract_der(certs[0])).freeze
          end

          private

          def extract_der(cert)
            stringio = StringIO.new
            cert.derEncode(stringio.to_outputstream)
            stringio.string
          end
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
rails-auth-2.1.4 lib/rails/auth/x509/filter/java.rb
rails-auth-2.1.3 lib/rails/auth/x509/filter/java.rb
rails-auth-2.1.2 lib/rails/auth/x509/filter/java.rb
rails-auth-2.1.1 lib/rails/auth/x509/filter/java.rb
rails-auth-2.1.0 lib/rails/auth/x509/filter/java.rb
rails-auth-2.0.3 lib/rails/auth/x509/filter/java.rb
rails-auth-2.0.2 lib/rails/auth/x509/filter/java.rb
rails-auth-2.0.1 lib/rails/auth/x509/filter/java.rb
rails-auth-1.3.0 lib/rails/auth/x509/filter/java.rb
rails-auth-1.2.0 lib/rails/auth/x509/filter/java.rb