Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package perl-Mojolicious-Plugin-OAuth2 for openSUSE:Factory checked in at 2022-02-15 23:57:43 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/perl-Mojolicious-Plugin-OAuth2 (Old) and /work/SRC/openSUSE:Factory/.perl-Mojolicious-Plugin-OAuth2.new.1956 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "perl-Mojolicious-Plugin-OAuth2" Tue Feb 15 23:57:43 2022 rev:4 rq:955045 version:2.02 Changes: -------- --- /work/SRC/openSUSE:Factory/perl-Mojolicious-Plugin-OAuth2/perl-Mojolicious-Plugin-OAuth2.changes 2021-11-06 18:21:21.876991521 +0100 +++ /work/SRC/openSUSE:Factory/.perl-Mojolicious-Plugin-OAuth2.new.1956/perl-Mojolicious-Plugin-OAuth2.changes 2022-02-15 23:58:08.896356321 +0100 @@ -1,0 +2,11 @@ +Wed Feb 9 03:06:18 UTC 2022 - Tina M??ller <timueller+p...@suse.de> + +- updated to 2.02 + see /usr/share/doc/packages/perl-Mojolicious-Plugin-OAuth2/Changes + + 2.02 2022-02-08T18:49:21+0900 + - Add support for passing in custom "ua" + - Add support for "providers" key in plugin config + - Add support for "proxy" in plugin config + +------------------------------------------------------------------- Old: ---- Mojolicious-Plugin-OAuth2-2.01.tar.gz New: ---- Mojolicious-Plugin-OAuth2-2.02.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ perl-Mojolicious-Plugin-OAuth2.spec ++++++ --- /var/tmp/diff_new_pack.QhizSR/_old 2022-02-15 23:58:09.332357525 +0100 +++ /var/tmp/diff_new_pack.QhizSR/_new 2022-02-15 23:58:09.336357536 +0100 @@ -1,7 +1,7 @@ # # spec file for package perl-Mojolicious-Plugin-OAuth2 # -# Copyright (c) 2021 SUSE LLC +# Copyright (c) 2022 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -18,10 +18,10 @@ %define cpan_name Mojolicious-Plugin-OAuth2 Name: perl-Mojolicious-Plugin-OAuth2 -Version: 2.01 +Version: 2.02 Release: 0 -License: Artistic-2.0 Summary: Auth against OAuth2 APIs including OpenID Connect +License: Artistic-2.0 URL: https://metacpan.org/release/%{cpan_name} Source0: https://cpan.metacpan.org/authors/id/J/JH/JHTHORSEN/%{cpan_name}-%{version}.tar.gz Source1: cpanspec.yml ++++++ Mojolicious-Plugin-OAuth2-2.01.tar.gz -> Mojolicious-Plugin-OAuth2-2.02.tar.gz ++++++ Binary files old/Mojolicious-Plugin-OAuth2-2.01/.pls_cache/index and new/Mojolicious-Plugin-OAuth2-2.02/.pls_cache/index differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-Plugin-OAuth2-2.01/Changes new/Mojolicious-Plugin-OAuth2-2.02/Changes --- old/Mojolicious-Plugin-OAuth2-2.01/Changes 2021-10-28 11:29:45.000000000 +0200 +++ new/Mojolicious-Plugin-OAuth2-2.02/Changes 2022-02-08 10:49:21.000000000 +0100 @@ -1,5 +1,10 @@ Revision history for perl distribution Mojolicious-Plugin-OAuth2 +2.02 2022-02-08T18:49:21+0900 + - Add support for passing in custom "ua" + - Add support for "providers" key in plugin config + - Add support for "proxy" in plugin config + 2.01 2021-10-28T18:29:45+0900 - Test suite is compatible with older versions of Mojolicious - OpenID Connect require Mojo::JWT 0.09 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-Plugin-OAuth2-2.01/META.json new/Mojolicious-Plugin-OAuth2-2.02/META.json --- old/Mojolicious-Plugin-OAuth2-2.01/META.json 2021-10-28 11:29:46.000000000 +0200 +++ new/Mojolicious-Plugin-OAuth2-2.02/META.json 2022-02-08 10:49:22.000000000 +0100 @@ -57,7 +57,7 @@ "web" : "https://github.com/marcusramberg/Mojolicious-Plugin-OAuth2" } }, - "version" : "2.01", + "version" : "2.02", "x_contributors" : [ "Marcus Ramberg <mramb...@cpan.org>", "Jan Henning Thorsen <jhthor...@cpan.org>" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-Plugin-OAuth2-2.01/META.yml new/Mojolicious-Plugin-OAuth2-2.02/META.yml --- old/Mojolicious-Plugin-OAuth2-2.01/META.yml 2021-10-28 11:29:46.000000000 +0200 +++ new/Mojolicious-Plugin-OAuth2-2.02/META.yml 2022-02-08 10:49:22.000000000 +0100 @@ -28,7 +28,7 @@ bugtracker: https://github.com/marcusramberg/Mojolicious-Plugin-OAuth2/issues homepage: https://github.com/marcusramberg/Mojolicious-Plugin-OAuth2 repository: https://github.com/marcusramberg/Mojolicious-Plugin-OAuth2.git -version: '2.01' +version: '2.02' x_contributors: - 'Marcus Ramberg <mramb...@cpan.org>' - 'Jan Henning Thorsen <jhthor...@cpan.org>' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-Plugin-OAuth2-2.01/README.md new/Mojolicious-Plugin-OAuth2-2.02/README.md --- old/Mojolicious-Plugin-OAuth2-2.01/README.md 2021-10-28 11:29:45.000000000 +0200 +++ new/Mojolicious-Plugin-OAuth2-2.02/README.md 2022-02-08 10:49:21.000000000 +0100 @@ -9,9 +9,11 @@ use Mojolicious::Lite; plugin OAuth2 => { - facebook => { - key => 'some-public-app-id', - secret => $ENV{OAUTH2_FACEBOOK_SECRET}, + providers => { + facebook => { + key => 'some-public-app-id', + secret => $ENV{OAUTH2_FACEBOOK_SECRET}, + }, }, }; @@ -213,24 +215,48 @@ ## register $app->plugin(OAuth2 => \%provider_config); + $app->plugin(OAuth2 => {providers => \%provider_config, proxy => 1, ua => Mojo::UserAgent->new}); Will register this plugin in your application with a given `%provider_config`. The keys in `%provider_config` are provider names and the values are configuration for each provider. Note that the value will be merged with the predefined providers below. +Instead of just passing in `%provider_config`, it is possible to pass in a +more complex config, with these keys: + +- providers + + The `%provider_config` must be present under this key. + +- proxy + + Setting this to a true value will automatically detect proxy settings using + ["detect" in Mojo::UserAgent::Proxy](https://metacpan.org/pod/Mojo%3A%3AUserAgent%3A%3AProxy#detect). + +- ua + + A custom [Mojo::UserAgent](https://metacpan.org/pod/Mojo%3A%3AUserAgent), in case you want to change proxy settings, + timeouts or other attributes. + +Instead of just passing in `%provider_config`, it is possible to pass in a +hash-ref "providers" (`%provider_config`) and "ua" (a custom +[Mojo::UserAgent](https://metacpan.org/pod/Mojo%3A%3AUserAgent) object). + Here is an example to add adddition information like "key" and "secret": $app->plugin(OAuth2 => { - custom_provider => { - key => 'APP_ID', - secret => 'SECRET_KEY', - authorize_url => 'https://provider.example.com/auth', - token_url => 'https://provider.example.com/token', - }, - github => { - key => 'APP_ID', - secret => 'SECRET_KEY', + providers => { + custom_provider => { + key => 'APP_ID', + secret => 'SECRET_KEY', + authorize_url => 'https://provider.example.com/auth', + token_url => 'https://provider.example.com/token', + }, + github => { + key => 'APP_ID', + secret => 'SECRET_KEY', + }, }, }); @@ -238,10 +264,12 @@ `well_known_url` so these are replaced by the `well_known_url` key. $app->plugin(OAuth2 => { - azure_ad => { - key => 'APP_ID', - secret => 'SECRET_KEY', - well_known_url => 'https://login.microsoftonline.com/tenant-id/v2.0/.well-known/openid-configuration', + providers => { + azure_ad => { + key => 'APP_ID', + secret => 'SECRET_KEY', + well_known_url => 'https://login.microsoftonline.com/tenant-id/v2.0/.well-known/openid-configuration', + }, }, }); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-Plugin-OAuth2-2.01/lib/Mojolicious/Plugin/OAuth2.pm new/Mojolicious-Plugin-OAuth2-2.02/lib/Mojolicious/Plugin/OAuth2.pm --- old/Mojolicious-Plugin-OAuth2-2.01/lib/Mojolicious/Plugin/OAuth2.pm 2021-10-28 11:29:45.000000000 +0200 +++ new/Mojolicious-Plugin-OAuth2-2.02/lib/Mojolicious/Plugin/OAuth2.pm 2022-02-08 10:49:21.000000000 +0100 @@ -9,7 +9,7 @@ use constant MOJO_JWT => eval 'use Mojo::JWT 0.09; use Crypt::OpenSSL::RSA; use Crypt::OpenSSL::Bignum; 1'; our @CARP_NOT = qw(Mojolicious::Plugin::OAuth2 Mojolicious::Renderer); -our $VERSION = '2.01'; +our $VERSION = '2.02'; has providers => sub { return { @@ -50,7 +50,15 @@ sub register { my ($self, $app, $config) = @_; - my $providers = $self->providers; + + if ($config->{providers}) { + $self->_config_to_providers($config->{providers}); + $self->_ua($config->{ua}) if $config->{ua}; + $self->_ua->proxy->detect if $config->{proxy}; + } + else { + $self->_config_to_providers($config); + } $app->helper('oauth2.auth_url' => sub { $self->_call(_auth_url => @_) }); $app->helper('oauth2.get_refresh_token_p' => sub { $self->_call(_get_refresh_token_p => @_) }); @@ -59,8 +67,7 @@ $app->helper('oauth2.logout_url' => sub { $self->_call(_logout_url => @_) }); $app->helper('oauth2.providers' => sub { $self->providers }); - $self->_config_to_providers($config); - $self->_apply_mock($providers->{mocked}) if $providers->{mocked}{key}; + $self->_apply_mock($self->providers->{mocked}) if $self->providers->{mocked}{key}; $self->_warmup_openid($app); } @@ -241,9 +248,11 @@ use Mojolicious::Lite; plugin OAuth2 => { - facebook => { - key => 'some-public-app-id', - secret => $ENV{OAUTH2_FACEBOOK_SECRET}, + providers => { + facebook => { + key => 'some-public-app-id', + secret => $ENV{OAUTH2_FACEBOOK_SECRET}, + }, }, }; @@ -462,24 +471,52 @@ =head2 register $app->plugin(OAuth2 => \%provider_config); + $app->plugin(OAuth2 => {providers => \%provider_config, proxy => 1, ua => Mojo::UserAgent->new}); Will register this plugin in your application with a given C<%provider_config>. The keys in C<%provider_config> are provider names and the values are configuration for each provider. Note that the value will be merged with the predefined providers below. +Instead of just passing in C<%provider_config>, it is possible to pass in a +more complex config, with these keys: + +=over 2 + +=item * providers + +The C<%provider_config> must be present under this key. + +=item * proxy + +Setting this to a true value will automatically detect proxy settings using +L<Mojo::UserAgent::Proxy/detect>. + +=item * ua + +A custom L<Mojo::UserAgent>, in case you want to change proxy settings, +timeouts or other attributes. + +=back + +Instead of just passing in C<%provider_config>, it is possible to pass in a +hash-ref "providers" (C<%provider_config>) and "ua" (a custom +L<Mojo::UserAgent> object). + Here is an example to add adddition information like "key" and "secret": $app->plugin(OAuth2 => { - custom_provider => { - key => 'APP_ID', - secret => 'SECRET_KEY', - authorize_url => 'https://provider.example.com/auth', - token_url => 'https://provider.example.com/token', - }, - github => { - key => 'APP_ID', - secret => 'SECRET_KEY', + providers => { + custom_provider => { + key => 'APP_ID', + secret => 'SECRET_KEY', + authorize_url => 'https://provider.example.com/auth', + token_url => 'https://provider.example.com/token', + }, + github => { + key => 'APP_ID', + secret => 'SECRET_KEY', + }, }, }); @@ -487,10 +524,12 @@ C<well_known_url> so these are replaced by the C<well_known_url> key. $app->plugin(OAuth2 => { - azure_ad => { - key => 'APP_ID', - secret => 'SECRET_KEY', - well_known_url => 'https://login.microsoftonline.com/tenant-id/v2.0/.well-known/openid-configuration', + providers => { + azure_ad => { + key => 'APP_ID', + secret => 'SECRET_KEY', + well_known_url => 'https://login.microsoftonline.com/tenant-id/v2.0/.well-known/openid-configuration', + }, }, }); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-Plugin-OAuth2-2.01/t/Helper.pm new/Mojolicious-Plugin-OAuth2-2.02/t/Helper.pm --- old/Mojolicious-Plugin-OAuth2-2.01/t/Helper.pm 2018-08-30 12:21:58.000000000 +0200 +++ new/Mojolicious-Plugin-OAuth2-2.02/t/Helper.pm 2022-02-08 09:48:51.000000000 +0100 @@ -9,13 +9,16 @@ $app->plugin( OAuth2 => { - test => { - authorize_url => '/oauth/authorize', - token_url => '/oauth/token', - key => 'fake_key', - secret => 'fake_secret', - scope => 'a,b,c', - } + ua => $app->ua, + providers => { + test => { + authorize_url => '/oauth/authorize', + token_url => '/oauth/token', + key => 'fake_key', + secret => 'fake_secret', + scope => 'a,b,c', + }, + }, } ); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-Plugin-OAuth2-2.01/t/delayed.t new/Mojolicious-Plugin-OAuth2-2.02/t/delayed.t --- old/Mojolicious-Plugin-OAuth2-2.01/t/delayed.t 2021-10-26 14:09:52.000000000 +0200 +++ new/Mojolicious-Plugin-OAuth2-2.02/t/delayed.t 2022-02-08 09:49:33.000000000 +0100 @@ -4,7 +4,7 @@ my $app = t::Helper->make_app; my $t = Test::Mojo->new($app); -Mojo::Util::monkey_patch('Mojolicious::Plugin::OAuth2', _ua => sub { $t->ua }); +$t->app->ua->server($t->ua->server); $app->routes->get( '/oauth-delayed' => sub { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-Plugin-OAuth2-2.01/t/error.t new/Mojolicious-Plugin-OAuth2-2.02/t/error.t --- old/Mojolicious-Plugin-OAuth2-2.01/t/error.t 2018-08-30 12:16:23.000000000 +0200 +++ new/Mojolicious-Plugin-OAuth2-2.02/t/error.t 2022-02-08 09:49:33.000000000 +0100 @@ -4,22 +4,18 @@ my $app = t::Helper->make_app; my $t = Test::Mojo->new($app); -Mojo::Util::monkey_patch('Mojolicious::Plugin::OAuth2', _ua => sub { $t->ua }); +$t->app->ua->server($t->ua->server); $app->routes->get( '/oauth-error' => sub { my $c = shift; - $c->oauth2->get_token_p('test')->then( - sub { - return unless my $provider_res = shift; - return $c->render(text => "Token $provider_res->{access_token}"); - } - )->catch( - sub { - return $c->render(text => shift, status => 500); - } - ); + $c->oauth2->get_token_p('test')->then(sub { + return unless my $provider_res = shift; + return $c->render(text => "Token $provider_res->{access_token}"); + })->catch(sub { + return $c->render(text => shift, status => 500); + }); } );