Class: FirebaseIdToken::Testing::Certificates
- Inherits:
-
Object
- Object
- FirebaseIdToken::Testing::Certificates
- Defined in:
- lib/firebase_id_token/testing/certificates.rb
Overview
When executing the test, manage secret key and certificate with Fixture. Valid for Ruby applications using minitest
Access Certificates.
FirebaseIdToken.test! is required to start using this class.
When implementing minitest, always return the same certificate.
Provide secret key for encoding JWT.
List of available methods
Class Method Summary collapse
-
.certificate ⇒ string
Return the certificate defined by Fixture.
-
.find(kid, raise_error: false, source: :id_token) ⇒ nil, OpenSSL::X509::Certificate
.findis stubbed to always return the same certificate. - .jwt_json ⇒ Object
-
.private_key ⇒ string
Return the secret key defined by Fixture.
- .read_jwt_file ⇒ Object
Class Method Details
.certificate ⇒ string
Return the certificate defined by Fixture.
66 67 68 |
# File 'lib/firebase_id_token/testing/certificates.rb', line 66 def self.certificate @certs ||= jwt_json['certificate'] end |
.find(kid, raise_error: false, source: :id_token) ⇒ nil, OpenSSL::X509::Certificate
.find is stubbed to always return the same certificate.
18 19 20 21 |
# File 'lib/firebase_id_token/testing/certificates.rb', line 18 def self.find(kid, raise_error: false, source: :id_token) cert = certificate OpenSSL::X509::Certificate.new cert end |
.jwt_json ⇒ Object
72 73 74 |
# File 'lib/firebase_id_token/testing/certificates.rb', line 72 def self.jwt_json @jwt_json ||= JSON.parse read_jwt_file end |
.private_key ⇒ string
Return the secret key defined by Fixture.
42 43 44 |
# File 'lib/firebase_id_token/testing/certificates.rb', line 42 def self.private_key @rsa_private ||= jwt_json['private_key'] end |
.read_jwt_file ⇒ Object
76 77 78 79 80 81 82 |
# File 'lib/firebase_id_token/testing/certificates.rb', line 76 def self.read_jwt_file File.read( File.( File.join(FirebaseIdToken::LIB_PATH, '..', 'spec', 'fixtures', 'files', 'jwt.json') ) ) end |