Class: DeviceAuthorizationsController
- Inherits:
-
Doorkeeper::ApplicationController
- Object
- Doorkeeper::ApplicationController
- DeviceAuthorizationsController
- Defined in:
- app/controllers/device_authorizations_controller.rb
Instance Method Summary collapse
Instance Method Details
#approve ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'app/controllers/device_authorizations_controller.rb', line 7 def approve session[:device_grant_id] = nil device_grant = device_grant_model.lock.find_by(user_code: user_code) if device_grant.nil? (:invalid_user_code) return end if device_grant.expired? (:expired_user_code) end session[:device_grant_id] = device_grant.id @client = Doorkeeper::Application.find_by(id: device_grant.application_id) @scopes = device_grant.scopes.split(" ") end |
#authorize ⇒ Object
23 24 25 26 27 28 29 |
# File 'app/controllers/device_authorizations_controller.rb', line 23 def device_grant_model.transaction do device_grant_model.lock.find_by(id: session[:device_grant_id]).update!(user_code: nil, resource_owner_id: current_resource_owner.id) render "success" end end |
#destroy ⇒ Object
31 32 33 34 |
# File 'app/controllers/device_authorizations_controller.rb', line 31 def destroy device_grant_model.lock.find_by(id: session[:device_grant_id]).destroy # standard:disable Rails/SaveBang render plain: "The authorization request was denied" end |
#index ⇒ Object
4 5 |
# File 'app/controllers/device_authorizations_controller.rb', line 4 def index end |
#success ⇒ Object
36 37 |
# File 'app/controllers/device_authorizations_controller.rb', line 36 def success end |