diff --git a/html/captive-portal/lib/captiveportal/PacketFence/DynamicRouting/Module/Authentication/OAuth/Facebook.pm b/html/captive-portal/lib/captiveportal/PacketFence/DynamicRouting/Module/Authentication/OAuth/Facebook.pm
index a433d2c29c69..473637403fb2 100644
--- a/html/captive-portal/lib/captiveportal/PacketFence/DynamicRouting/Module/Authentication/OAuth/Facebook.pm
+++ b/html/captive-portal/lib/captiveportal/PacketFence/DynamicRouting/Module/Authentication/OAuth/Facebook.pm
@@ -13,7 +13,16 @@ Facebook OAuth module
use Moose;
extends 'captiveportal::DynamicRouting::Module::Authentication::OAuth';
-has '+source' => (isa => 'pf::Authentication::Source::FacebookSource');
+has '+source' => (
+ isa => 'pf::Authentication::Source::FacebookSource',
+ lazy => 1,
+ builder => '_build_source',
+);
+
+sub _build_source {
+ my ($self) = @_;
+ return $self->app->profile->getSourceByType('Facebook');
+}
=head1 AUTHOR
diff --git a/html/captive-portal/lib/captiveportal/PacketFence/DynamicRouting/Module/Authentication/OAuth/Github.pm b/html/captive-portal/lib/captiveportal/PacketFence/DynamicRouting/Module/Authentication/OAuth/Github.pm
index f4bcd7c1412b..839030bf111d 100644
--- a/html/captive-portal/lib/captiveportal/PacketFence/DynamicRouting/Module/Authentication/OAuth/Github.pm
+++ b/html/captive-portal/lib/captiveportal/PacketFence/DynamicRouting/Module/Authentication/OAuth/Github.pm
@@ -13,7 +13,11 @@ Github OAuth module
use Moose;
extends 'captiveportal::DynamicRouting::Module::Authentication::OAuth';
-has '+source' => (isa => 'pf::Authentication::Source::GithubSource');
+has '+source' => (
+ isa => 'pf::Authentication::Source::GithubSource',
+ lazy => 1,
+ builder => '_build_source',
+);
has '+token_scheme' => (default => "auth-header:token");
@@ -28,6 +32,11 @@ sub _extract_username_from_response {
return $info->{email} || $info->{login}.'@github';
}
+sub _build_source {
+ my ($self) = @_;
+ return $self->app->profile->getSourceByType('Github');
+}
+
=head1 AUTHOR
Inverse inc.
diff --git a/html/captive-portal/lib/captiveportal/PacketFence/DynamicRouting/Module/Authentication/OAuth/Google.pm b/html/captive-portal/lib/captiveportal/PacketFence/DynamicRouting/Module/Authentication/OAuth/Google.pm
index 6584b223dd9d..9067a2a5fb84 100644
--- a/html/captive-portal/lib/captiveportal/PacketFence/DynamicRouting/Module/Authentication/OAuth/Google.pm
+++ b/html/captive-portal/lib/captiveportal/PacketFence/DynamicRouting/Module/Authentication/OAuth/Google.pm
@@ -13,7 +13,16 @@ Google OAuth module
use Moose;
extends 'captiveportal::DynamicRouting::Module::Authentication::OAuth';
-has '+source' => (isa => 'pf::Authentication::Source::GoogleSource');
+has '+source' => (
+ isa => 'pf::Authentication::Source::GoogleSource',
+ lazy => 1,
+ builder => '_build_source',
+);
+
+sub _build_source {
+ my ($self) = @_;
+ return $self->app->profile->getSourceByType('Google');
+}
=head1 AUTHOR
diff --git a/html/captive-portal/lib/captiveportal/PacketFence/DynamicRouting/Module/Authentication/OAuth/LinkedIn.pm b/html/captive-portal/lib/captiveportal/PacketFence/DynamicRouting/Module/Authentication/OAuth/LinkedIn.pm
index 3dd311b13756..43a8f37565b3 100644
--- a/html/captive-portal/lib/captiveportal/PacketFence/DynamicRouting/Module/Authentication/OAuth/LinkedIn.pm
+++ b/html/captive-portal/lib/captiveportal/PacketFence/DynamicRouting/Module/Authentication/OAuth/LinkedIn.pm
@@ -17,7 +17,11 @@ use JSON::MaybeXS;
has '+token_scheme' => (default => 'auth-header:Bearer');
-has '+source' => (isa => 'pf::Authentication::Source::LinkedInSource');
+has '+source' => (
+ isa => 'pf::Authentication::Source::LinkedInSource',
+ lazy => 1,
+ builder => '_build_source',
+);
=head2 _decode_response
@@ -31,6 +35,11 @@ sub _decode_response {
return {email => $data->{elements}->[0]->{'handle~'}->{emailAddress}};
}
+sub _build_source {
+ my ($self) = @_;
+ return $self->app->profile->getSourceByType('LinkedIn');
+}
+
=head1 AUTHOR
Inverse inc.
diff --git a/html/captive-portal/lib/captiveportal/PacketFence/DynamicRouting/Module/Authentication/OAuth/OpenID.pm b/html/captive-portal/lib/captiveportal/PacketFence/DynamicRouting/Module/Authentication/OAuth/OpenID.pm
index 48756c67d2a7..e58c32257cd7 100644
--- a/html/captive-portal/lib/captiveportal/PacketFence/DynamicRouting/Module/Authentication/OAuth/OpenID.pm
+++ b/html/captive-portal/lib/captiveportal/PacketFence/DynamicRouting/Module/Authentication/OAuth/OpenID.pm
@@ -14,7 +14,11 @@ use Moose;
use pf::person qw(person_view);
extends 'captiveportal::DynamicRouting::Module::Authentication::OAuth';
-has '+source' => (isa => 'pf::Authentication::Source::OpenIDSource');
+has '+source' => (
+ isa => 'pf::Authentication::Source::OpenIDSource',
+ lazy => 1,
+ builder => '_build_source',
+);
has 'token_scheme' => (is => 'rw', default => sub {"auth-header:Bearer"});
@@ -41,6 +45,11 @@ sub auth_source_params_child {
return $self->source->map_from_person($info);
}
+sub _build_source {
+ my ($self) = @_;
+ return $self->app->profile->getSourceByType('OpenID');
+}
+
=head1 AUTHOR
Inverse inc.
diff --git a/html/captive-portal/lib/captiveportal/PacketFence/DynamicRouting/Module/Authentication/OAuth/WindowsLive.pm b/html/captive-portal/lib/captiveportal/PacketFence/DynamicRouting/Module/Authentication/OAuth/WindowsLive.pm
index d28d9ccc1c27..656bf30caeb5 100644
--- a/html/captive-portal/lib/captiveportal/PacketFence/DynamicRouting/Module/Authentication/OAuth/WindowsLive.pm
+++ b/html/captive-portal/lib/captiveportal/PacketFence/DynamicRouting/Module/Authentication/OAuth/WindowsLive.pm
@@ -15,7 +15,11 @@ extends 'captiveportal::DynamicRouting::Module::Authentication::OAuth';
has '+token_scheme' => (default => "auth-header:Bearer");
-has '+source' => (isa => 'pf::Authentication::Source::WindowsLiveSource');
+has '+source' => (
+ isa => 'pf::Authentication::Source::WindowsLiveSource',
+ lazy => 1,
+ builder => '_build_source',
+);
=head2 _extract_username_from_response
@@ -28,6 +32,11 @@ sub _extract_username_from_response {
return $info->{emails}->{account};
}
+sub _build_source {
+ my ($self) = @_;
+ return $self->app->profile->getSourceByType('WindowsLive');
+}
+
=head1 AUTHOR
Inverse inc.