summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Henning Thorsen <jhthorsen@cpan.org>2022-02-08 17:56:00 +0900
committerJan Henning Thorsen <jhthorsen@cpan.org>2022-02-08 18:01:58 +0900
commitcaafe10ec92fae5bc0bc7c9feb33f386c2c3bfd2 (patch)
treefb2b50abda7be20ac4eccef1a7509f6b4dd85c6b
parent4a5cb81df3be6411f82e68b0d3b82db842a0ef53 (diff)
Add support for "proxy"
-rw-r--r--Changes1
-rw-r--r--lib/Mojolicious/Plugin/OAuth2.pm8
2 files changed, 8 insertions, 1 deletions
diff --git a/Changes b/Changes
index 3899c08..57f3309 100644
--- a/Changes
+++ b/Changes
@@ -3,6 +3,7 @@ Revision history for perl distribution Mojolicious-Plugin-OAuth2
2.02 Not Released
- 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
diff --git a/lib/Mojolicious/Plugin/OAuth2.pm b/lib/Mojolicious/Plugin/OAuth2.pm
index 8aae532..658fce4 100644
--- a/lib/Mojolicious/Plugin/OAuth2.pm
+++ b/lib/Mojolicious/Plugin/OAuth2.pm
@@ -54,6 +54,7 @@ sub register {
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);
@@ -470,7 +471,7 @@ Holds a hash of provider information. See L</oauth2.providers>.
=head2 register
$app->plugin(OAuth2 => \%provider_config);
- $app->plugin(OAuth2 => {providers => \%provider_config, ua => Mojo::UserAgent->new});
+ $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
@@ -486,6 +487,11 @@ more complex config, with these keys:
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,