Class: FirebaseTokenAuthentication::GoogleX509Certificate
- Inherits:
-
Object
- Object
- FirebaseTokenAuthentication::GoogleX509Certificate
- Defined in:
- lib/firebase_token_authentication/google_x509_certificate.rb
Constant Summary collapse
- GOOGLE_CERT_URL =
"https://www.googleapis.com/robot/v1/metadata/x509/[email protected]"
Instance Method Summary collapse
Instance Method Details
#fetch_certificates ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/firebase_token_authentication/google_x509_certificate.rb', line 17 def fetch_certificates client = Faraday.new do |builder| builder.use Faraday::HttpCache, store: FirebaseTokenAuthentication.config.cache_store, logger: FirebaseTokenAuthentication.config.logger builder.adapter Faraday.default_adapter end response = client.get(GOOGLE_CERT_URL, {}, { "Accept" => "application/json" }) JSON.parse(response.body) end |
#find(key_id) ⇒ Object
11 12 13 14 15 |
# File 'lib/firebase_token_authentication/google_x509_certificate.rb', line 11 def find(key_id) certificate = fetch_certificates[key_id] return OpenSSL::X509::Certificate.new(certificate) if certificate end |