Class: IapAuthenticator::IapAuth
- Inherits:
-
Object
- Object
- IapAuthenticator::IapAuth
- Defined in:
- lib/iap_authenticator/iap_auth.rb
Instance Attribute Summary collapse
-
#jws ⇒ Object
readonly
Returns the value of attribute jws.
Instance Method Summary collapse
-
#initialize ⇒ IapAuth
constructor
A new instance of IapAuth.
- #token ⇒ Object
Constructor Details
#initialize ⇒ IapAuth
Returns a new instance of IapAuth.
4 5 6 7 8 9 10 |
# File 'lib/iap_authenticator/iap_auth.rb', line 4 def initialize @configuration = IapAuthenticator.configuration json_from_file = File.read(@configuration.service_account_credentials_path) service_account = JSON.parse(json_from_file) private_key = IapAuthenticator::Pkey.parse(service_account['private_key']) @jws = IapAuthenticator::JWS.new(private_key, @configuration.refresh_time_seconds, service_account['client_email'], @configuration.client_id) end |
Instance Attribute Details
#jws ⇒ Object (readonly)
Returns the value of attribute jws.
3 4 5 |
# File 'lib/iap_authenticator/iap_auth.rb', line 3 def jws @jws end |
Instance Method Details
#token ⇒ Object
12 13 14 15 16 |
# File 'lib/iap_authenticator/iap_auth.rb', line 12 def token assertion = self.jws.assertion token = IapAuthenticator::Token.generate_bearer_token( assertion) return token end |