Class: Opro::Oauth::AuthController
- Inherits:
-
OproController
- Object
- ApplicationController
- OproController
- Opro::Oauth::AuthController
- Defined in:
- app/controllers/opro/oauth/auth_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
:ask_user! is called before creating a new authorization, this allows us to redirect.
- #new ⇒ Object
Instance Method Details
#create ⇒ Object
:ask_user! is called before creating a new authorization, this allows us to redirect
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'app/controllers/opro/oauth/auth_controller.rb', line 15 def create # find or create an auth_grant for a given user application = Opro::Oauth::ClientApp.find_by_app_id(params[:client_id]) auth_grant = Opro::Oauth::AuthGrant.where( :user_id => current_user.id, :application_id => application.id).first auth_grant ||= Opro::Oauth::AuthGrant.create(:user => current_user, :application => application) # add permission changes if there are any auth_grant.update_attributes(:permissions => params[:permissions]) if auth_grant. != params[:permissions] redirect_to auth_grant.redirect_uri_for(params[:redirect_uri], params[:state]) end |