Class: Oauth::TokenInfoController

Inherits:
Doorkeeper::TokenInfoController
  • Object
show all
Includes:
EnforcesTwoFactorAuthentication
Defined in:
app/controllers/oauth/token_info_controller.rb

Constant Summary

Constants included from EnforcesTwoFactorAuthentication

EnforcesTwoFactorAuthentication::MFA_HELP_PAGE

Instance Method Summary collapse

Methods included from EnforcesTwoFactorAuthentication

#check_two_factor_requirement, #current_user_requires_two_factor?, #skip_two_factor?, #two_factor_authentication_reason, #two_factor_authentication_required?, #two_factor_grace_period, #two_factor_grace_period_expired?, #two_factor_skippable?, #two_factor_verifier

Instance Method Details

#showObject


6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'app/controllers/oauth/token_info_controller.rb', line 6

def show
  if doorkeeper_token && doorkeeper_token.accessible?
    token_json = doorkeeper_token.as_json

    # maintain backwards compatibility
    render json: token_json.merge(
      'scopes'             => token_json[:scope],
      'expires_in_seconds' => token_json[:expires_in]
    ), status: :ok
  else
    error = Doorkeeper::OAuth::InvalidTokenResponse.new
    response.headers.merge!(error.headers)
    render json: error.body, status: error.status
  end
end