Mojolicious-Plugin-SslAuth
view release on metacpan or search on metacpan
0.08 2014-01-12
- generate_port moved to Mojo::IOLoop::Server in Mojolicious 5.0 - reneeb
0.07 2012-05-26
- POD fix
0.06 2012-05-25
- Adjusted for recent prepare_ioloop removal Test::Mojo changes
0.05 2011-06-13
- Bumped Mojolicious & IO::Socket::SSL requirements
0.04 2011-06-08
- Added github urls to metadata
- Added github urls to metadata
configure_requires:
ExtUtils::MakeMaker: '0'
dynamic_config: 0
generated_by: 'Dist::Zilla version 5.020, CPAN::Meta::Converter version 2.142060'
license: perl
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
version: '1.4'
name: Mojolicious-Plugin-SslAuth
requires:
IO::Socket::SSL: '1.44'
Mojolicious: '5.0'
resources:
repository: git://github.com/tempire/mojolicious-plugin-sslauth.git
version: '0.08'
Makefile.PL view on Meta::CPAN
"ABSTRACT" => "SSL client certificate auth helper",
"AUTHOR" => "Glen Hinkle <tempire\@cpan.org>",
"CONFIGURE_REQUIRES" => {
"ExtUtils::MakeMaker" => 0
},
"DISTNAME" => "Mojolicious-Plugin-SslAuth",
"EXE_FILES" => [],
"LICENSE" => "perl",
"NAME" => "Mojolicious::Plugin::SslAuth",
"PREREQ_PM" => {
"IO::Socket::SSL" => "1.44",
"Mojolicious" => "5.0"
},
"VERSION" => "0.08",
"test" => {
"TESTS" => "t/*.t"
}
);
my %FallbackPrereqs = (
"IO::Socket::SSL" => "1.44",
"Mojolicious" => "5.0"
);
unless ( eval { ExtUtils::MakeMaker->VERSION(6.63_03) } ) {
delete $WriteMakefileArgs{TEST_REQUIRES};
delete $WriteMakefileArgs{BUILD_REQUIRES};
$WriteMakefileArgs{PREREQ_PM} = \%FallbackPrereqs;
}
my $self = shift;
return $self->render_text('ok')
if $self->ssl_auth(
{return 1 if shift->peer_certificate('commonName') eq 'client'}
);
};
app->start;
L<IO::Socket::SSL> connection passed as parameter.
See L<IO::Socket::SSL> for available methods. (You're most likely looking for ->peer_certificate and/or ->get_cipher)
=over
=item Older versions of Mojolicious
For Mojolicious versions < 2.81, use Mojolicious::Plugin::SslAuth 0.05
For Mojolicious versions < 1.13, use Mojolicious::Plugin::SslAuth 0.02
=back
bundle = @Basic
remove = Readme
[MetaResources]
repository.web = https://github.com/tempire/mojolicious-plugin-sslauth
repository.url = git://github.com/tempire/mojolicious-plugin-sslauth.git
repository.type = git
[Prereqs]
Mojolicious = 5.0
IO::Socket::SSL = 1.44
lib/Mojolicious/Plugin/SslAuth.pm view on Meta::CPAN
$app->helper(
ssl_auth => sub {
my $self = shift;
my $callback = shift;
my $id = $self->tx->connection;
my $handle = Mojo::IOLoop->stream($id)->handle;
# Not SSL connection
return if ref $handle ne 'IO::Socket::SSL';
return $callback->($handle);
}
);
}
1;
__END__
=head1 NAME
lib/Mojolicious/Plugin/SslAuth.pm view on Meta::CPAN
return $self->render_text('ok')
if $self->ssl_auth(
{return 1 if shift->peer_certificate('commonName') eq 'client'}
);
$self->render_text('commonName not matched');
};
app->start;
L<IO::Socket::SSL> connection passed as parameter.
See L<IO::Socket::SSL> for available methods. (You're most likely looking for ->peer_certificate and/or ->get_cipher)
=over
=item Older versions of Mojolicious
For Mojolicious versions >= 5.0, use Mojolicious::Plugin::SslAuth 0.08
For Mojolicious versions < 2.81, use Mojolicious::Plugin::SslAuth 0.05
For Mojolicious versions < 1.13, use Mojolicious::Plugin::SslAuth 0.02
#use IO::Socket::SSL 'debug4';
use IO::Socket::SSL;
use Mojo::IOLoop;
use Test::More;
use Test::Mojo;
# Make sure sockets are working
plan skip_all => 'working sockets required for this test!'
unless Mojo::IOLoop::Server->generate_port; # Test server
# Lite app
use Mojolicious::Lite;
( run in 0.586 second using v1.01-cache-2.11-cpan-4d50c553e7e )