Class: Compass::InfoController
- Inherits:
-
ApplicationController
- Object
- ActionController::API
- ApplicationController
- Compass::InfoController
- Defined in:
- app/controllers/compass/info_controller.rb
Overview
Info controller.
Instance Method Summary collapse
Methods inherited from ApplicationController
#authenticate, #current_context, #current_context_id, #validate_context
Instance Method Details
#auth ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'app/controllers/compass/info_controller.rb', line 15 def auth expiration = Compass.config.client.auth_expires_at&.call(**current_context) token = Compass.config.client.auth_token&.call(**current_context) if expiration&.future? expires_in(expiration - Time.now) else expires_now end if token.present? render json: { Authorization: "Bearer #{token}" } else render json: {} end end |