- Timestamp:
- 08/17/08 22:56:26 (5 years ago)
- Location:
- lang/perl/mobirc/trunk
- Files:
-
- 9 modified
-
lib/App/Mobirc/Plugin/Authorizer/BasicAuth.pm (modified) (3 diffs)
-
lib/App/Mobirc/Plugin/Authorizer/Cookie.pm (modified) (1 diff)
-
lib/App/Mobirc/Plugin/Authorizer/DoCoMoGUID.pm (modified) (2 diffs)
-
lib/App/Mobirc/Plugin/Authorizer/EZSubscriberID.pm (modified) (2 diffs)
-
lib/App/Mobirc/Plugin/Authorizer/SoftBankID.pm (modified) (2 diffs)
-
lib/App/Mobirc/Validator.pm (modified) (1 diff)
-
lib/App/Mobirc/Web/Handler.pm (modified) (2 diffs)
-
t/Plugins/Authorizer/BasicAuth.t (modified) (1 diff)
-
t/Plugins/Authorizer/DoCoMoGUID-authorizer.t (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
lang/perl/mobirc/trunk/lib/App/Mobirc/Plugin/Authorizer/BasicAuth.pm
r13227 r17793 4 4 use Carp; 5 5 use App::Mobirc::Util; 6 use App::Mobirc::Validator; 6 7 7 8 has username => ( … … 18 19 19 20 hook authorize => sub { 20 my ( $self, $global_context, $ c, ) = @_;21 my ( $self, $global_context, $req, ) = validate_hook('authorize', @_); 21 22 22 23 DEBUG "Basic Auth..."; … … 24 25 my $cred = $self->{username} . ':' . $self->{password}; 25 26 26 my $sent_cred = $ c->req->headers->authorization_basic;27 my $sent_cred = $req->headers->authorization_basic; 27 28 if ( defined($sent_cred) && $sent_cred eq $cred ) { 28 29 return true; -
lang/perl/mobirc/trunk/lib/App/Mobirc/Plugin/Authorizer/Cookie.pm
r13013 r17793 22 22 23 23 hook authorize => sub { 24 my ( $self, $global_context, $ c, ) = validate_hook('authorize', @_);24 my ( $self, $global_context, $req, ) = validate_hook('authorize', @_); 25 25 26 my $cookie_str = $ c->req->header('Cookie');26 my $cookie_str = $req->header('Cookie'); 27 27 unless ($cookie_str) { 28 28 DEBUG "cookie header is empty"; -
lang/perl/mobirc/trunk/lib/App/Mobirc/Plugin/Authorizer/DoCoMoGUID.pm
r13318 r17793 5 5 use App::Mobirc::Util; 6 6 use HTML::StickyQuery::DoCoMoGUID; 7 use App::Mobirc::Validator; 7 8 8 9 has docomo_guid => ( … … 13 14 14 15 hook authorize => sub { 15 my ( $self, $global_context, $ c, ) = @_;16 my ( $self, $global_context, $req, ) = validate_hook('authorize', @_); 16 17 17 my $subno = $ c->req->header('x-dcmguid');18 my $subno = $req->header('x-dcmguid'); 18 19 if ( $subno && $subno eq $self->docomo_guid ) { 19 20 DEBUG "SUCESS AT DocomoGUID"; -
lang/perl/mobirc/trunk/lib/App/Mobirc/Plugin/Authorizer/EZSubscriberID.pm
r13013 r17793 4 4 use Carp; 5 5 use App::Mobirc::Util; 6 use App::Mobirc::Validator; 6 7 7 8 has 'au_subscriber_id' => ( … … 12 13 13 14 hook authorize => sub { 14 my ( $self, $global_context, $ c, ) = @_;15 my ( $self, $global_context, $req, ) = validate_hook('authorize', @_); 15 16 16 my $subno = $ c->req->header('x-up-subno');17 my $subno = $req->header('x-up-subno'); 17 18 if ( $subno && $subno eq $self->au_subscriber_id ) { 18 19 DEBUG "SUCESS AT EZSubscriberID"; -
lang/perl/mobirc/trunk/lib/App/Mobirc/Plugin/Authorizer/SoftBankID.pm
r13013 r17793 4 4 use Carp; 5 5 use App::Mobirc::Util; 6 use App::Mobirc::Validator; 6 7 7 8 has jphone_uid => ( … … 12 13 13 14 hook authorize => sub { 14 my ( $self, $global_context, $ c ) = @_;15 my ( $self, $global_context, $req, ) = validate_hook('authorize', @_); 15 16 16 my $uid = $ c->req->header('x-jphone-uid');17 my $uid = $req->header('x-jphone-uid'); 17 18 if ( $uid && $uid eq $self->jphone_uid ) { 18 19 return true; -
lang/perl/mobirc/trunk/lib/App/Mobirc/Validator.pm
r17622 r17793 11 11 { can => 'register' }, 12 12 { isa => 'App::Mobirc' }, 13 { isa => 'HTTP::Engine:: Compat::Context' },13 { isa => 'HTTP::Engine::Request' }, 14 14 ], 15 15 response_filter => [ -
lang/perl/mobirc/trunk/lib/App/Mobirc/Web/Handler.pm
r17792 r17793 29 29 context->run_hook('request_filter', $req); 30 30 31 if (authorize($ c)) {31 if (authorize($req)) { 32 32 process_request($c); 33 33 context->run_hook('response_filter', $c); … … 44 44 45 45 sub authorize { 46 my $ c= shift;46 my $req = shift; 47 47 48 if (context->run_hook_first('authorize', $ c)) {48 if (context->run_hook_first('authorize', $req)) { 49 49 DEBUG "AUTHORIZATION SUCCEEDED"; 50 50 return 1; # authorization succeeded. -
lang/perl/mobirc/trunk/t/Plugins/Authorizer/BasicAuth.t
r17622 r17793 15 15 $mobirc->load_plugin( {module => 'Authorizer::BasicAuth', config => {username => 'dankogai', password => 'kogaidan'}} ); 16 16 17 ok !$mobirc->run_hook_first('authorize', create_ c('dankogai', 'dankogai'));18 ok $mobirc->run_hook_first('authorize', create_ c('dankogai', 'kogaidan'));17 ok !$mobirc->run_hook_first('authorize', create_req('dankogai', 'dankogai')); 18 ok $mobirc->run_hook_first('authorize', create_req('dankogai', 'kogaidan')); 19 19 20 sub create_ c{20 sub create_req { 21 21 my ($user, $passwd) = @_; 22 22 my $c = HTTP::Engine::Compat::Context->new; 23 23 $c->req->header('Authorization' => 'Basic ' . MIME::Base64::encode("$user:$passwd", '')); 24 $c ;24 $c->req; 25 25 } 26 26 -
lang/perl/mobirc/trunk/t/Plugins/Authorizer/DoCoMoGUID-authorizer.t
r17622 r17793 17 17 $mobirc->load_plugin( {module => 'Authorizer::DoCoMoGUID', config => {docomo_guid => 'foobar.docomo'}} ); 18 18 19 ok $mobirc->run_hook_first('authorize', create_ c('foobar.docomo')), 'login succeeded';20 ok !$mobirc->run_hook_first('authorize', create_ c('invalid_login_id')), 'login failed';19 ok $mobirc->run_hook_first('authorize', create_req('foobar.docomo')), 'login succeeded'; 20 ok !$mobirc->run_hook_first('authorize', create_req('invalid_login_id')), 'login failed'; 21 21 22 sub create_ c{22 sub create_req { 23 23 my $guid = shift; 24 24 my $c = HTTP::Engine::Compat::Context->new; 25 25 $c->req->header('x-dcmguid' => $guid); 26 $c ;26 $c->req; 27 27 } 28 28
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)