Skip to content

Commit

Permalink
Use signatures in OpenQA::WebAPI::Auth::OpenID
Browse files Browse the repository at this point in the history
  • Loading branch information
okurz committed Nov 11, 2021
1 parent 3137223 commit c721bf8
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions lib/OpenQA/WebAPI/Auth/OpenID.pm
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@
# SPDX-License-Identifier: GPL-2.0-or-later

package OpenQA::WebAPI::Auth::OpenID;
use Mojo::Base -base;
use Mojo::Base -base, -signatures;

use OpenQA::Log qw(log_error);
use LWP::UserAgent;
use Net::OpenID::Consumer;
use MIME::Base64 qw(encode_base64url decode_base64url);

sub auth_login {
my ($self) = @_;
sub auth_login ($self) {
my $url = $self->app->config->{global}->{base_url} || $self->req->url->base->to_string;

# force secure connection after login
Expand Down Expand Up @@ -64,13 +63,9 @@ sub auth_login {
return (error => $csr->err);
}

sub _first_last_name {
my ($ax) = @_;
return join(' ', $ax->{'value.firstname'} // '', $ax->{'value.lastname'} // '');
}
sub _first_last_name ($ax) { join(' ', $ax->{'value.firstname'} // '', $ax->{'value.lastname'} // '') }

sub _handle_verified {
my $vident = shift;
sub _handle_verified ($vident) {
my $sreg = $vident->signed_extension_fields('http://openid.net/extensions/sreg/1.1');
my $ax = $vident->signed_extension_fields('http://openid.net/srv/ax/1.0');

Expand All @@ -92,9 +87,7 @@ sub _handle_verified {
$self->session->{user} = $vident->{identity};
}

sub auth_response {
my ($self) = @_;

sub auth_response ($self) {
my %params = @{$self->req->params->pairs};
my $url = $self->app->config->{global}->{base_url} || $self->req->url->base;
return (error => 'Got response on http but https is forced. MOJO_REVERSE_PROXY not set?')
Expand Down

0 comments on commit c721bf8

Please sign in to comment.