-
Notifications
You must be signed in to change notification settings - Fork 293
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use source from profile if not defined in module
- Loading branch information
1 parent
2acb4bb
commit 70ee116
Showing
6 changed files
with
60 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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. <[email protected]> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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. <[email protected]> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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. <[email protected]> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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. <[email protected]> | ||
|