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
12 13 14 15 16 17 18 19 20 |
# File 'app/controllers/opro/oauth/auth_controller.rb', line 12 def create # find or create an auth_grant for a given user application = Opro::Oauth::ClientApp.find_by_client_id(params[:client_id]) auth_grant = Opro::Oauth::AuthGrant.find_or_create_by_user_app(current_user, application) # add permission changes if there are any auth_grant.(params[:permissions]) redirect_to auth_grant.redirect_uri_for(params[:redirect_uri], params[:state]) end |
#new ⇒ Object
5 6 7 8 9 |
# File 'app/controllers/opro/oauth/auth_controller.rb', line 5 def new @redirect_uri = params[:redirect_uri] @client_app = Opro::Oauth::ClientApp.find_by_app_id(params[:client_id]) @scopes = scope_from_params(params) end |