Class: PrxAuth::Rails::SessionsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- PrxAuth::Rails::SessionsController
- Defined in:
- app/controllers/prx_auth/rails/sessions_controller.rb
Constant Summary collapse
- ID_NONCE_SESSION_KEY =
"id_prx_openid_nonce"- DEFAULT_SCOPES =
"openid"
Instance Method Summary collapse
Instance Method Details
#auth_error ⇒ Object
46 47 48 |
# File 'app/controllers/prx_auth/rails/sessions_controller.rb', line 46 def auth_error @auth_error_message = params.require(:error) end |
#create ⇒ Object
50 51 52 53 54 55 56 57 58 59 60 |
# File 'app/controllers/prx_auth/rails/sessions_controller.rb', line 50 def create valid_and_matching = valid_nonce? && users_match? clear_nonce! if valid_and_matching sign_in_user(access_token) redirect_to after_sign_in_path_for(current_user) else redirect_to auth_error_sessions_path(error: params[:error] || "unknown_error") end end |
#destroy ⇒ Object
41 42 43 44 |
# File 'app/controllers/prx_auth/rails/sessions_controller.rb', line 41 def destroy sign_out_user redirect_to after_sign_out_path end |
#new ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'app/controllers/prx_auth/rails/sessions_controller.rb', line 15 def new config = PrxAuth::Rails.configuration scope = if config.prx_scope.present? "#{DEFAULT_SCOPES} #{config.prx_scope}" else DEFAULT_SCOPES end id_auth_params = { client_id: config.prx_client_id, nonce: fetch_nonce, response_type: "id_token token", scope: scope, prompt: "necessary" } url = "//" + config.id_host + "/authorize?" + id_auth_params.to_query redirect_to url, allow_other_host: true end |
#show ⇒ Object
38 39 |
# File 'app/controllers/prx_auth/rails/sessions_controller.rb', line 38 def show end |