Class: Authorio::AuthController
- Inherits:
-
AuthorioController
- Object
- ActionController::Base
- AuthorioController
- Authorio::AuthController
- Defined in:
- app/controllers/authorio/auth_controller.rb
Instance Method Summary collapse
-
#authorization_interface ⇒ Object
GET /auth.
-
#authorize_user ⇒ Object
POST /user/:id/authorize.
- #issue_token ⇒ Object
- #send_profile ⇒ Object
- #verify_token ⇒ Object
Methods inherited from AuthorioController
#authorized?, #current_user, #index, #logged_in?, #profile_url, #rememberable?, #user_scope_description, #user_session
Instance Method Details
#authorization_interface ⇒ Object
GET /auth
21 22 23 24 25 |
# File 'app/controllers/authorio/auth_controller.rb', line 21 def session.update auth_interface_params.slice(:state, :client_id, :code_challenge, :redirect_uri) rescue ActionController::ParameterMissing, ActionController::UnpermittedParameters => e render oauth_error 'invalid_request', e end |
#authorize_user ⇒ Object
POST /user/:id/authorize
28 29 30 31 32 33 34 35 |
# File 'app/controllers/authorio/auth_controller.rb', line 28 def redirect_to(session[:client_id], allow_other_host: true) and return if params[:commit] == 'Cancel' @user = authenticate_user_from_session_or_password (@user) if auth_user_params[:remember_me] create_auth_request redirect_to_client end |
#issue_token ⇒ Object
41 42 43 44 |
# File 'app/controllers/authorio/auth_controller.rb', line 41 def issue_token @auth_request = find_auth_request or (render validation_failed and return) @token = Token.create_from_request(@auth_request) end |
#send_profile ⇒ Object
37 38 39 |
# File 'app/controllers/authorio/auth_controller.rb', line 37 def send_profile @auth_request = find_auth_request or (render validation_failed and return) end |
#verify_token ⇒ Object
46 47 48 49 50 51 52 |
# File 'app/controllers/authorio/auth_controller.rb', line 46 def verify_token @token = Token.find_by_auth_token(bearer_token) or (head :bad_request and return) return unless @token.expired? @token.delete render token_expired end |