Sha256: fd29d9626de9b0ddfa49f29318624b85a787d9ec669254b7faa892b34f799679
Contents?: true
Size: 1.75 KB
Versions: 3
Compression:
Stored size: 1.75 KB
Contents
# frozen_string_literal: true # Define methods that can be called in any controller that inherits from # Doorkeeper::ApplicationMetalController or Doorkeeper::ApplicationController module Doorkeeper module Helpers module Controller private # :doc: def authenticate_resource_owner! current_resource_owner end # :doc: def current_resource_owner instance_eval(&Doorkeeper.configuration.authenticate_resource_owner) end def resource_owner_from_credentials instance_eval(&Doorkeeper.configuration.resource_owner_from_credentials) end # :doc: def authenticate_admin! instance_eval(&Doorkeeper.configuration.authenticate_admin) end def server @server ||= Server.new(self) end # :doc: def doorkeeper_token @doorkeeper_token ||= OAuth::Token.authenticate request, *config_methods end def config_methods @config_methods ||= Doorkeeper.configuration.access_token_methods end def get_error_response_from_exception(exception) OAuth::ErrorResponse.new name: exception.type, state: params[:state] end def handle_token_exception(exception) error = get_error_response_from_exception exception headers.merge! error.headers self.response_body = error.body.to_json self.status = error.status end def skip_authorization? !!instance_exec([@server.current_resource_owner, @pre_auth.client], &Doorkeeper.configuration.skip_authorization) end def enforce_content_type return if request.content_type == 'application/x-www-form-urlencoded' render json: {}, status: :unsupported_media_type end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
doorkeeper-5.0.3 | lib/doorkeeper/helpers/controller.rb |
doorkeeper-5.0.2 | lib/doorkeeper/helpers/controller.rb |
doorkeeper-5.0.1 | lib/doorkeeper/helpers/controller.rb |