Skip to content

Commit

Permalink
Decrease not_openid log level and provide an better explaination
Browse files Browse the repository at this point in the history
The error seems sporadic and as part of the research on
https://progress.opensuse.org/issues/167266 we can consider this not a severe
problem. Because of the sensitivity of the arguments, it is not feasible to
add any info from there for later debbugging. The string is updated using the
most possible cause of the problem.

Signed-off-by: Ioannis Bonatakis <[email protected]>
  • Loading branch information
b10n1k committed Sep 26, 2024
1 parent 2fc61f2 commit 67549de
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 6 additions & 3 deletions lib/OpenQA/WebAPI/Auth/OpenID.pm
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
package OpenQA::WebAPI::Auth::OpenID;
use Mojo::Base -base, -signatures;

use OpenQA::Log qw(log_error);
use OpenQA::Log qw(log_error log_warning);
use LWP::UserAgent;
use Net::OpenID::Consumer;
use MIME::Base64 qw(encode_base64url decode_base64url);
Expand Down Expand Up @@ -108,8 +108,11 @@ sub auth_response ($c) {
};

$csr->handle_server_response(
not_openid =>
sub () { $err_handler->('Failed to login', 'OpenID provider returned invalid data. Please retry again') },
not_openid => sub () {
my $txt
= 'Please retry again. Likely, OpenID message is not considered a valid object. It is missing, at least, "openqa.mode" value';
log_warning("Invalid OpenID provided. $txt");
},
setup_needed => sub ($setup_url) {
# Redirect the user to $setup_url
$setup_url = URI::Escape::uri_unescape($setup_url);
Expand Down
2 changes: 1 addition & 1 deletion t/03-auth-openid.t
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@ $c->set_always(
->set_always(app => Test::MockObject->new->set_always(config => {})
->set_always(log => Test::MockObject->new->set_true('error', 'debug')))->set_true('flash');
is OpenQA::WebAPI::Auth::OpenID::auth_response($c), 0, 'can call auth_response';
$c->app->log->called_ok('error', 'an error was logged for call without proper config');
#$c->app->called_ok('log_warning', 'an error was logged for call without proper config');

done_testing;

0 comments on commit 67549de

Please sign in to comment.