Module: SignIn::Concerns::Certifiable

Extended by:
ActiveSupport::Concern
Included in:
SignIn::ClientConfig, ServiceAccountConfig
Defined in:
app/models/sign_in/concerns/certifiable.rb

Instance Method Summary collapse

Instance Method Details

#assertion_public_keysObject



8
9
10
# File 'app/models/sign_in/concerns/certifiable.rb', line 8

def assertion_public_keys
  @assertion_public_keys ||= certificate_objects.map(&:public_key)
end

#certificate_objectsObject (private)



32
33
34
# File 'app/models/sign_in/concerns/certifiable.rb', line 32

def certificate_objects
  @certificate_objects ||= load_certificate_objects
end

#expired_certificatesObject



12
13
14
15
16
# File 'app/models/sign_in/concerns/certifiable.rb', line 12

def expired_certificates
  @expired_certificates ||= certificate_objects.select do |certificate|
    certificate.not_after < Time.zone.now
  end
end

#expiring_certificatesObject



18
19
20
21
22
# File 'app/models/sign_in/concerns/certifiable.rb', line 18

def expiring_certificates
  @expiring_certificates ||= certificate_objects.select do |certificate|
    certificate.not_after < 60.days.from_now
  end
end

#load_certificate_objectsObject (private)



36
37
38
39
40
41
42
# File 'app/models/sign_in/concerns/certifiable.rb', line 36

def load_certificate_objects
  return [] if certificates.blank?

  certificates.compact.map do |certificate|
    OpenSSL::X509::Certificate.new(certificate)
  end
end

#self_signed_certificatesObject



24
25
26
27
28
# File 'app/models/sign_in/concerns/certifiable.rb', line 24

def self_signed_certificates
  @self_signed_certificates ||= certificate_objects.select do |certificate|
    certificate.issuer == certificate.subject
  end
end