Skip to content
Extraits de code Groupes Projets
Valider fd4022a5 rédigé par theworldbright's avatar theworldbright
Parcourir les fichiers

Fix pronto remarks

parent 773a5a67
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
@import 'perfect-scrollbar'; @import 'perfect-scrollbar';
@import 'color-variables'; @import 'color-variables';
@import "bootstrap-complete.scss"; @import 'bootstrap-complete';
@import 'mixins'; @import 'mixins';
...@@ -99,11 +99,11 @@ ...@@ -99,11 +99,11 @@
@import 'statistics'; @import 'statistics';
/* gallery */ /* gallery */
@import "blueimp-gallery"; @import 'blueimp-gallery';
@import "gallery"; @import 'gallery';
// settings // settings
@import 'user_applications'; @import 'user_applications';
// API // OpenID Connect (API)
@import "openid_connect_error_page"; @import 'openid_connect_error_page';
.api-error { .api-error {
margin-top: 20px;
box-shadow: $card-shadow;
background-color: $light-grey; background-color: $light-grey;
box-shadow: $card-shadow;
margin-top: 20px;
h4 { text-align: center; } h4 { text-align: center; }
} }
...@@ -3,7 +3,7 @@ module Api ...@@ -3,7 +3,7 @@ module Api
class AuthorizationsController < ApplicationController class AuthorizationsController < ApplicationController
rescue_from Rack::OAuth2::Server::Authorize::BadRequest do |e| rescue_from Rack::OAuth2::Server::Authorize::BadRequest do |e|
logger.info e.backtrace[0, 10].join("\n") logger.info e.backtrace[0, 10].join("\n")
error, description = e.message.split(" :: ") error, _description = e.message.split(" :: ")
handle_params_error(error, "The request was malformed: please double check the client id and redirect uri.") handle_params_error(error, "The request was malformed: please double check the client id and redirect uri.")
end end
...@@ -210,17 +210,7 @@ module Api ...@@ -210,17 +210,7 @@ module Api
def handle_prompt_none def handle_prompt_none
if params[:prompt] == "none" if params[:prompt] == "none"
if user_signed_in? if user_signed_in?
client_id = params[:client_id] handle_prompt_with_signed_in_user
if client_id
auth = Api::OpenidConnect::Authorization.find_by_client_id_and_user(client_id, current_user)
if auth
process_authorization_consent("true")
else
handle_params_error("interaction_required", "User must already be authorized when `prompt` is `none`")
end
else
handle_params_error("bad_request", "Client ID is missing from request")
end
else else
handle_params_error("login_required", "User must already be logged in when `prompt` is `none`") handle_params_error("login_required", "User must already be logged in when `prompt` is `none`")
end end
...@@ -229,6 +219,20 @@ module Api ...@@ -229,6 +219,20 @@ module Api
end end
end end
def handle_prompt_with_signed_in_user
client_id = params[:client_id]
if client_id
auth = Api::OpenidConnect::Authorization.find_by_client_id_and_user(client_id, current_user)
if auth
process_authorization_consent("true")
else
handle_params_error("interaction_required", "User must already be authorized when `prompt` is `none`")
end
else
handle_params_error("bad_request", "Client ID is missing from request")
end
end
def render_error(error_description) def render_error(error_description)
@error_description = error_description @error_description = error_description
render "api/openid_connect/error/error", render "api/openid_connect/error/error",
......
...@@ -37,4 +37,3 @@ end ...@@ -37,4 +37,3 @@ end
Then(/^I should see a message containing "(.*?)"$/) do |message| Then(/^I should see a message containing "(.*?)"$/) do |message|
expect(find("#openid_connect_error_description").text).to eq(message) expect(find("#openid_connect_error_description").text).to eq(message)
end end
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter