Class: Authorio::AuthController

Inherits:
AuthorioController show all
Defined in:
app/controllers/authorio/auth_controller.rb

Instance Method Summary collapse

Methods inherited from AuthorioController

#authorized?, #current_user, #index, #logged_in?, #profile_url, #rememberable?, #user_scope_description, #user_session

Instance Method Details

#authorization_interfaceObject

GET /auth



21
22
23
24
25
# File 'app/controllers/authorio/auth_controller.rb', line 21

def authorization_interface
  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_userObject

POST /user/:id/authorize



28
29
30
31
32
33
34
35
# File 'app/controllers/authorio/auth_controller.rb', line 28

def authorize_user
  redirect_to(session[:client_id], allow_other_host: true) and return if params[:commit] == 'Cancel'

  @user = authenticate_user_from_session_or_password
  write_session_cookie(@user) if auth_user_params[:remember_me]
  create_auth_request
  redirect_to_client
end

#issue_tokenObject



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_profileObject



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_tokenObject



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