Class: Platforms::Certificate

Inherits:
ApplicationRecord show all
Defined in:
app/models/platforms/certificate.rb

Overview

Stores customer-specific certificates for authentication

Instance Method Summary collapse

Instance Method Details

#client_secret_privacyString

Show a redacted client_secret for admin purposes. If the client_secret is too short, redacts entirely. Otherwise shows the last 3 characters.

Returns:

  • (String)

    redacted client_secret



26
27
28
29
30
# File 'app/models/platforms/certificate.rb', line 26

def client_secret_privacy
  return nil if client_secret.nil?
  return "*****" if client_secret.length < 10
  "*****#{client_secret.last(3)}"
end

#credentialsHash

Credentials formatted for OmniAuth

Returns:

  • (Hash)

    with keys of client_id and client_secret



34
35
36
37
38
39
# File 'app/models/platforms/certificate.rb', line 34

def credentials
  {
    client_id: client_id,
    client_secret: client_secret
  }
end