PlugAuth — Pluggable authentication and authorization server.
Mojolicious::Plugin::BasicAuth — Basic HTTP Auth Helper
#!perl
my $b = $r->under(
'/' . $self->prefix => sub {
my $c = shift;
my $remote_addr = $c->remote_addr;
return 1 if $remote_addr =~ /^10.(\d{1..3}).(\d{1..3}).(\d{1..3})$/o;
return 1 if $remote_addr eq '127.0.0.1';
if (
$c->basic_auth(
realm => sub {
my ($user, $password) = @_;
return 1 if $user eq 'lalala' and $password eq 'lalala';
}
)
)
{
return 1;
}
else { $c->render(text => 'Permission Denied.'); return 0; }
}
)->to(extends => 'layouts/default', title => 'Title');
Mojolicious::Plugin::Authentication — на рассмотрении
Mojocast #3: Authentication, Helpers, and Plugins — пример разработки аутентификации, Mojolicious::Plugin::ParamsAuth
Leave a Reply
You must be logged in to post a comment.