view release on metacpan or search on metacpan
inc/Test/Pod.pm
inc/Test/Pod/Coverage.pm
lib/Egg/Helper/Model/Auth.pm
lib/Egg/Model/Auth.pm
lib/Egg/Model/Auth/API/DBI.pm
lib/Egg/Model/Auth/API/DBIC.pm
lib/Egg/Model/Auth/API/File.pm
lib/Egg/Model/Auth/Base.pm
lib/Egg/Model/Auth/Base/API.pm
lib/Egg/Model/Auth/Bind/Cookie.pm
lib/Egg/Model/Auth/Crypt/CBC.pm
lib/Egg/Model/Auth/Crypt/Func.pm
lib/Egg/Model/Auth/Crypt/MD5.pm
lib/Egg/Model/Auth/Crypt/SHA1.pm
lib/Egg/Model/Auth/Plugin/Keep.pm
lib/Egg/Model/Auth/Session/FileCache.pm
lib/Egg/Model/Auth/Session/SessionKit.pm
lib/Egg/Release/Authorize.pm
Makefile.PL
MANIFEST This list of files
META.yml
version: 0.02
author:
- 'Masatoshi Mizuno E<lt>lusheE<64>cpan.orgE<gt>'
abstract: lib/Egg/Release/Authorize.pm
license: perl
resources:
license: http://dev.perl.org/licenses/
requires:
Cache::Cache: 1.05
Crypt::Blowfish: 2.10
Crypt::CBC: 2.24
Crypt::Camellia: 2.01
Crypt::DES: 2.05
Digest::MD5: 2.36
Digest::SHA1: 2.11
Egg::Plugin::SessionKit: 3.02
Egg::Release: 3.01
Egg::Release::DBI: 0.02
Egg::Release::DBIC: 0.02
Test::More: 0
Test::Perl::Critic: 0
file: lib/Egg/Model/Auth/API/File.pm
version: 0.01
Egg::Model::Auth::Base:
file: lib/Egg/Model/Auth/Base.pm
version: 0.01
Egg::Model::Auth::Base::API:
file: lib/Egg/Model/Auth/Base/API.pm
version: 0.01
Egg::Model::Auth::Bind::Cookie:
file: lib/Egg/Model/Auth/Bind/Cookie.pm
Egg::Model::Auth::Crypt::CBC:
file: lib/Egg/Model/Auth/Crypt/CBC.pm
version: 0.01
Egg::Model::Auth::Crypt::Func:
file: lib/Egg/Model/Auth/Crypt/Func.pm
version: 0.01
Egg::Model::Auth::Crypt::MD5:
file: lib/Egg/Model/Auth/Crypt/MD5.pm
version: 0.01
Egg::Model::Auth::Crypt::SHA1:
file: lib/Egg/Model/Auth/Crypt/SHA1.pm
version: 0.01
Makefile.PL view on Meta::CPAN
abstract_from 'lib/Egg/Release/Authorize.pm';
author 'Masatoshi Mizuno E<lt>lusheE<64>cpan.orgE<gt>';
license 'perl';
requires 'Egg::Release' => '3.14';
requires 'Egg::Plugin::SessionKit' => '3.02';
requires 'Egg::Release::DBI' => '0.02';
requires 'Egg::Release::DBIC' => '0.02';
requires 'Digest::MD5' => '2.36';
requires 'Digest::SHA1' => '2.11';
requires 'Crypt::CBC' => '2.24';
requires 'Crypt::Blowfish' => '2.10';
requires 'Crypt::DES' => '2.05';
requires 'Crypt::Camellia' => '2.01';
requires 'Cache::Cache' => '1.05';
build_requires 'Test::More';
build_requires 'Test::Pod';
build_requires 'Test::Perl::Critic';
build_requires 'Test::Pod::Coverage';
lib/Egg/Model/Auth/Base/API.pm view on Meta::CPAN
package MyApp::Model::Auth::MyAuth;
...........
....
__PACKAGE__->setup_api( File=> qw/ Crypt::SHA1 / );
see
L<Egg::Model::Auth::Crypt::SHA1>,
L<Egg::Model::Auth::Crypt::MD5>,
L<Egg::Model::Auth::Crypt::Func>,
L<Egg::Model::Auth::Crypt::CBC>,
=head1 SEE ALSO
L<Egg::Release>,
L<Egg::Model::Auth>,
L<Egg::Model::Auth::Base>,
L<Egg::Base>,
L<Egg::Component>,
=head1 AUTHOR
lib/Egg/Model/Auth/Crypt/CBC.pm view on Meta::CPAN
package Egg::Model::Auth::Crypt::CBC;
#
# Masatoshi Mizuno E<lt>lusheE<64>cpan.orgE<gt>
#
# $Id: CBC.pm 347 2008-06-14 18:57:53Z lushe $
#
use strict;
use warnings;
use Carp qw/ croak /;
use Crypt::CBC;
our $VERSION= '0.01';
sub _setup {
my($class, $e)= @_;
$class->config->{crypt_cbc_salt} ||= "";
my $c= $class->config->{crypt_cbc} ||= {};
$c->{cipher} || die __PACKAGE__. q{ - I want setup 'crypt_cbc->{cipher}'.};
$c->{key} || die __PACKAGE__. q{ - I want setup 'crypt_cbc->{key}'.};
$c->{iv} ||= '$KJh#(}q';
$c->{padding} ||= 'standard';
$c->{prepend_iv} = 0 unless exists($c->{prepend_iv});
$c->{regenerate_key}= 1 unless exists($c->{regenerate_key});
$class->next::method($e);
}
sub __cbc {
${$_[0]}->{_crypt_cbc} ||= Crypt::CBC->new($_[0]->config->{crypt_cbc});
}
sub password_check {
my $self = shift;
my $crypt= shift || croak 'I want crypt string.';
$crypt=~s{^\s+} []; $crypt=~s{\s+$} [];
my $password= shift || croak 'I want target password.';
$password=~s{^\s+} []; $password=~s{\s+$} [];
$password eq $self->__cbc->decrypt_hex($crypt) ? 1: 0;
}
sub create_password {
lib/Egg/Model/Auth/Crypt/CBC.pm view on Meta::CPAN
$password=~s{^\s+} []; $password=~s{\s+$} [];
$self->__cbc->encrypt_hex($password. $self->config->{crypt_cbc_salt});
}
1;
__END__
=head1 NAME
Egg::Model::Auth::Crypt::CBC - AUTH component to treat code of attestation data with Crypt::CBC.
=head1 SYNOPSIS
package MyApp::Model::Auth::MyAuth;
..........
__PACKAGE__->config(
crypt_cbc => {
cipher => 'Blowfish',
key => 'AbCd1234',
.......
...
},
);
__PACKAGE__->setup_api( File => qw/ Crypt::CBC / );
=head1 DESCRIPTION
It is API component to treat the password in the attestation data with L<Crypt::CBC>.
'Crypt::CBC' is included in the list following API component name that adds the
setting of 'crypt_cbc' to the configuration to use it and specifies it for
'setup_api' method.
__PACKAGE__->setup_api( File => qw/ Crypt::CBC / );
And, please set 'cipher' and 'key' used when the password in the attestation
data is encrypted in 'crypt_cbc'.
Additionally, all set content extends to Crypt::CBC.
=head1 METHODS
=head2 password_check ([CRYPT_PASSWORD], [INPUT_PAWWORD])
CRYPT_PASSWORD is decoded and whether it agrees is confirmed with INPUT_PAWWORD.
=head2 create_password ([PLAIN_PASSWORD])
PLAIN_PASSWORD is encrypted.
=head1 SEE ALSO
L<Egg::Release>,
L<Egg::Model::Auth>,
L<Egg::Model::Auth::Base::API>,
L<Crypt::CBC>,
=head1 AUTHOR
Masatoshi Mizuno E<lt>lusheE<64>cpan.orgE<gt>
=head1 COPYRIGHT AND LICENSE
Copyright (C) 2008 Bee Flag, Corp. E<lt>L<http://egg.bomcity.com/>E<gt>.
This library is free software; you can redistribute it and/or modify
lib/Egg/Model/Auth/Plugin/Keep.pm view on Meta::CPAN
package Egg::Model::Auth::Plugin::Keep;
#
# Masatoshi Mizuno E<lt>lusheE<64>cpan.orgE<gt>
#
# $Id: Keep.pm 347 2008-06-14 18:57:53Z lushe $
#
use strict;
use warnings;
use Carp qw/ croak /;
use Crypt::CBC;
use Digest::SHA1 qw/ sha1_hex /;
our $VERSION= '0.06';
my @Items= qw/ __api_name ___user ___input_password /;
sub _setup {
my($class, $e)= @_;
my $c= $class->config->{plugin_keep}
|| die q{I want setup 'plugin_keep'.};
lib/Egg/Model/Auth/Plugin/Keep.pm view on Meta::CPAN
$cbc->{cipher} || die q{I want setup 'crypt' of 'cipher'.};
$cbc->{key} || die q{I want setup 'crypt' of 'key'.};
$cbc->{iv} ||= '$KJh#(}q';
$cbc->{padding} ||= 'standard';
$cbc->{prepend_iv} = 0 unless exists($cbc->{prepend_iv});
$cbc->{regenerate_key}= 1 unless exists($cbc->{regenerate_key});
$class->next::method($e);
}
sub __keep_cbc {
$_[0]->{_crypt_keep_cbc}
||= Crypt::CBC->new($_[0]->config->{plugin_keep}{crypt});
}
sub is_login {
my $self= shift;
if (my $session= $self->get_session) { return $self->next::method($session) }
my $c= $self->config->{plugin_keep};
my $crypt= $self->e->request->cookie_value($c->{cookie}{name}) || return do {
$self->e->debug_out(__PACKAGE__. ' - Cookie data is empty.');
$self->next::method(1);
};
my $plain= $self->__keep_cbc->decrypt_hex($crypt) || return do {
lib/Egg/Model/Auth/Plugin/Keep.pm view on Meta::CPAN
=head3 cookie
The content is a parameter to pass it to 'cookie' method of L<Egg::Response>.
name ..... Name of Cookie. Default is 'aa'.
expires ..... Validity term of Cookie for perpetuity attestation. Default is '+7D'.
=head3 crypt
The content is an option to pass to L<Crypt::CBC>.
=head1 METHODS
=head2 is_login
If the attestation session exists and doesn't exist, attestation information is
acquired from Cookie, and the attestation session is revived.
And, processing is passed to 'is_login' of L<Egg::Model::Auth::Base>.
lib/Egg/Model/Auth/Plugin/Keep.pm view on Meta::CPAN
Cookie for the perpetuity attestation is annulled.
And, processing is passed to 'reset' of L<Egg::Model::Auth::Base>.
=head1 SEE ALSO
L<Egg::Release>,
L<Egg::Model::Auth>,
L<Egg::Model::Auth::Base>,
L<Egg::Response>,
L<Crypt::CBC>,
L<Digest::SHA1>,
=head1 AUTHOR
Masatoshi Mizuno E<lt>lusheE<64>cpan.orgE<gt>
=head1 COPYRIGHT AND LICENSE
Copyright (C) 2008 Bee Flag, Corp. E<lt>L<http://egg.bomcity.com/>E<gt>.
lib/Egg/Release/Authorize.pm view on Meta::CPAN
L<Egg::Model::Auth::API::DBI>,
L<Egg::Model::Auth::API::DBIC>,
L<Egg::Model::Auth::API::File>,
=item * Bind system.
L<Egg::Model::Auth::Bind::Cookie>,
=item * Crypt system.
L<Egg::Model::Auth::Crypt::CBC>,
L<Egg::Model::Auth::Crypt::Func>,
L<Egg::Model::Auth::Crypt::MD5>,
L<Egg::Model::Auth::Crypt::SHA1>,
=item * Plugin system.
L<Egg::Model::Auth::Plugin::Keep>,
=item * Session system.
BEGIN {
use_ok 'Egg::Release::Authorize';
use_ok 'Egg::Helper::Model::Auth';
use_ok 'Egg::Model::Auth';
use_ok 'Egg::Model::Auth::API::DBI';
use_ok 'Egg::Model::Auth::API::DBIC';
use_ok 'Egg::Model::Auth::API::File';
use_ok 'Egg::Model::Auth::Base';
use_ok 'Egg::Model::Auth::Base::API';
use_ok 'Egg::Model::Auth::Bind::Cookie';
use_ok 'Egg::Model::Auth::Crypt::CBC';
use_ok 'Egg::Model::Auth::Crypt::Func';
use_ok 'Egg::Model::Auth::Crypt::MD5';
use_ok 'Egg::Model::Auth::Crypt::SHA1';
use_ok 'Egg::Model::Auth::Plugin::Keep';
use_ok 'Egg::Model::Auth::Session::FileCache';
use_ok 'Egg::Model::Auth::Session::SessionKit';
};
t/08_crypt_cbc.t view on Meta::CPAN
use Test::More;
use lib qw( ../lib ./lib );
use Egg::Helper;
use UNIVERSAL::require;
unless ( Cache::FileCache->require ) {
plan skip_all=> "Cache::FileCache is not installed."
} else {
unless ( Crypt::CBC->require ) {
plan skip_all=> "Crypt::CBC is not installed."
} else {
test();
}
}
sub test {
my $ciper= Crypt::Blowfish->require ? 'Blowfish'
: Crypt::DES->require ? 'DES'
: Crypt::Camellia->require ? 'Camellia'
t/08_crypt_cbc.t view on Meta::CPAN
plan tests=> 39;
my $tool= Egg::Helper->helper_tools;
my $project= 'Vtest';
my $path = $tool->helper_tempdir. "/$project";
my $psw = '%test%';
my $key = '12345678';
my $salt = '';
my $passwd = do {
my $cbc= Crypt::CBC->new({
cipher => $ciper,
key => $key,
iv => '$KJh#(}q',
padding => 'standard',
prepend_iv => 0,
regenerate_key => 1,
});
$cbc->encrypt_hex($psw. $salt);
};
t/08_crypt_cbc.t view on Meta::CPAN
isa_ok $s, 'Vtest::Model::Auth::Test';
isa_ok $s, 'Egg::Model::Auth::Session::FileCache';
isa_ok $s, 'Egg::Model::Auth::Bind::Cookie';
isa_ok $s, 'Egg::Model::Auth::Base';
isa_ok $s, 'Egg::Base';
isa_ok $s, 'Egg::Component';
isa_ok $s, 'Egg::Component::Base';
ok my $a= $s->api, q{my $a= $s->api};
isa_ok $a, 'Vtest::Model::Auth::Test::API::File';
isa_ok $a, 'Egg::Model::Auth::Crypt::CBC';
isa_ok $a, 'Egg::Model::Auth::Base::API';
isa_ok $a, 'Egg::Component::Base';
$e->helper_create_dir($e->path_to('cache'));
##
can_ok $a, 'create_password';
is $a->create_password($psw), $passwd, qq{$a->create_password('$psw')};
##
t/08_crypt_cbc.t view on Meta::CPAN
id_field => 'uid',
password_field => 'psw',
active_field => 'active',
group_field => 'a_group',
delimiter => qr{ *\t *},
},
);
__PACKAGE__->setup_session( FileCache => 'Bind::Cookie' );
__PACKAGE__->setup_api( File => 'Crypt::CBC' );
1;
---
filename: <e.path>/etc/members
value: |
tester1 <e.passwd> 1 admin 20
tester2 1 users 21
tester3 <e.passwd> 0 users 22
tester4 <e.passwd> 1 users 23
t/10_plugin_keep.t view on Meta::CPAN
use Test::More;
use lib qw( ../lib ./lib );
use Egg::Helper;
eval{ require Cache::FileCache };
if ($@) {
plan skip_all=> "Cache::FileCache is not installed."
} else {
unless ( Crypt::CBC->require ) {
plan skip_all=> "Crypt::CBC is not installed."
} else {
test();
}
}
sub test {
my $ciper= Crypt::Blowfish->require ? 'Blowfish'
: Crypt::DES->require ? 'DES'
: Crypt::Camellia->require ? 'Camellia'
t/10_plugin_keep.t view on Meta::CPAN
isa_ok $s, 'Egg::Model::Auth::Bind::Cookie';
isa_ok $s, 'Egg::Model::Auth::Base';
isa_ok $s, 'Egg::Base';
isa_ok $s, 'Egg::Component';
isa_ok $s, 'Egg::Component::Base';
$e->helper_create_dir($e->path_to('cache'));
##
can_ok $s, '__keep_cbc';
isa_ok $s->__keep_cbc, 'Crypt::CBC';
##
my $param= $e->request->params;
$param->{__uid}= 'tester1';
$param->{__psw}= '%test%';
$param->{__auto_login}= 1;
can_ok $s, 'login_check';
ok my $data= $s->login_check, q{my $data= $s->login_check};
isa_ok $data, 'HASH';