Ark
view release on metacpan
or search on metacpan
Changes
view on Meta::CPAN
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | Revision history for Perl module Ark
1.22 2020-03-13T11:56:42Z
- fix dependencies
1.21 2020-03-13T06:48:52Z
- support HttpOnly and SameSite in Plugin::Session::State::Cookie (mackee)
1.20 2013-11-20T07:41:04Z
- [INCOMPATIBLE] rename X-JSON-Status to X-API-Status in View::JSON (hisaichi5518)
- add View::JSON
- depends on HTML::Shakan 2.00
1.13 2013-11-19T11:16:09Z
- X-JSON-Status support (hisaichi5518)
- use JSON instead of JSON::Any in Ark::View::JSON |
MANIFEST
view on Meta::CPAN
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | lib/Ark/Model.pm
lib/Ark/Model/Adaptor.pm
lib/Ark/Models.pm
lib/Ark/Plugin.pm
lib/Ark/Plugin/CSRFDefender.pm
lib/Ark/Plugin/Encoding/Null.pm
lib/Ark/Plugin/Encoding/Unicode.pm
lib/Ark/Plugin/FormValidator/Lite.pm
lib/Ark/Plugin/Session.pm
lib/Ark/Plugin/Session/Backend.pm
lib/Ark/Plugin/Session/State/Cookie.pm
lib/Ark/Plugin/Session/State/OpenSocial.pm
lib/Ark/Plugin/Session/State/URI.pm
lib/Ark/Plugin/Session/State/URI/ExtendContext.pm
lib/Ark/Plugin/Session/Store/Memory.pm
lib/Ark/Plugin/Session/Store/Model.pm
lib/Ark/Request.pm
lib/Ark/Response.pm
lib/Ark/Test.pm
lib/Ark/Test/Context.pm
lib/Ark/View.pm
|
META.json
view on Meta::CPAN
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | }
},
"runtime" : {
"recommends" : {
"Text::MicroTemplate::Extended" : "0.09" ,
"Text::Xslate" : "0"
},
"requires" : {
"Class::Data::Inheritable" : "0" ,
"Clone" : "0" ,
"Cookie::Baker" : "0.11" ,
"Data::UUID" : "0" ,
"Devel::StackTrace" : "0" ,
"Digest::SHA1" : "0" ,
"Exporter::AutoClean" : "0" ,
"FormValidator::Lite" : "0" ,
"HTML::Escape" : "0" ,
"HTML::Shakan" : "2.00" ,
"HTTP::Cookies" : "0" ,
"HTTP::Request" : "0" ,
"JSON" : "0" ,
"Mouse" : "1.00" ,
"Object::Container" : "0.08" ,
"Path::AttrRouter" : "0.03" ,
"Path::Class" : "0.16" ,
"Plack" : "0.9910" ,
"Plack::Request::WithEncoding" : "0.10" ,
"Text::MicroTemplate" : "0" ,
"Text::SimpleTable" : "0" ,
|
META.json
view on Meta::CPAN
152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 | },
"Ark::Plugin::FormValidator::Lite" : {
"file" : "lib/Ark/Plugin/FormValidator/Lite.pm"
},
"Ark::Plugin::Session" : {
"file" : "lib/Ark/Plugin/Session.pm"
},
"Ark::Plugin::Session::Backend" : {
"file" : "lib/Ark/Plugin/Session/Backend.pm"
},
"Ark::Plugin::Session::State::Cookie" : {
"file" : "lib/Ark/Plugin/Session/State/Cookie.pm"
},
"Ark::Plugin::Session::State::OpenSocial" : {
"file" : "lib/Ark/Plugin/Session/State/OpenSocial.pm"
},
"Ark::Plugin::Session::State::URI" : {
"file" : "lib/Ark/Plugin/Session/State/URI.pm"
},
"Ark::Plugin::Session::State::URI::ExtendContext" : {
"file" : "lib/Ark/Plugin/Session/State/URI/ExtendContext.pm"
},
|
META.yml
view on Meta::CPAN
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 | Ark::Plugin::Encoding::Null:
file: lib/Ark/Plugin/Encoding/Null.pm
Ark::Plugin::Encoding::Unicode:
file: lib/Ark/Plugin/Encoding/Unicode.pm
Ark::Plugin::FormValidator::Lite:
file: lib/Ark/Plugin/FormValidator/Lite.pm
Ark::Plugin::Session:
file: lib/Ark/Plugin/Session.pm
Ark::Plugin::Session::Backend:
file: lib/Ark/Plugin/Session/Backend.pm
Ark::Plugin::Session::State::Cookie:
file: lib/Ark/Plugin/Session/State/Cookie.pm
Ark::Plugin::Session::State::OpenSocial:
file: lib/Ark/Plugin/Session/State/OpenSocial.pm
Ark::Plugin::Session::State::URI:
file: lib/Ark/Plugin/Session/State/URI.pm
Ark::Plugin::Session::State::URI::ExtendContext:
file: lib/Ark/Plugin/Session/State/URI/ExtendContext.pm
Ark::Plugin::Session::Store::Memory:
file: lib/Ark/Plugin/Session/Store/Memory.pm
Ark::Plugin::Session::Store::Model:
file: lib/Ark/Plugin/Session/Store/Model.pm
|
META.yml
view on Meta::CPAN
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 | Ark::View::TT:
file: lib/Ark/View/TT.pm
Ark::View::Xslate:
file: lib/Ark/View/Xslate.pm
recommends:
Text::MicroTemplate::Extended: '0.09'
Text::Xslate: '0'
requires:
Class::Data::Inheritable: '0'
Clone: '0'
Cookie::Baker: '0.11'
Data::UUID: '0'
Devel::StackTrace: '0'
Digest::SHA1: '0'
Exporter::AutoClean: '0'
FormValidator::Lite: '0'
HTML::Escape: '0'
HTML::Shakan: '2.00'
HTTP::Cookies: '0'
HTTP::Request: '0'
JSON: '0'
Mouse: '1.00'
Object::Container: '0.08'
Path::AttrRouter: '0.03'
Path::Class: '0.16'
Plack: '0.9910'
Plack::Request::WithEncoding: '0.10'
Text::MicroTemplate: '0'
Text::SimpleTable: '0'
|
cpanfile
view on Meta::CPAN
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | requires 'Class::Data::Inheritable' ;
requires 'Clone' ;
requires 'Data::UUID' ;
requires 'Exporter::AutoClean' ;
requires 'FormValidator::Lite' ;
requires 'HTML::Escape' ;
requires 'HTML::Shakan' , '2.00' ;
requires 'HTTP::Cookies' ;
requires 'HTTP::Request' ;
requires 'JSON' ;
requires 'Mouse' , '1.00' ;
requires 'Object::Container' , '0.08' ;
requires 'Path::AttrRouter' , '0.03' ;
requires 'Path::Class' , '0.16' ;
requires 'Plack::Request::WithEncoding' , '0.10' ;
requires 'Plack' , '0.9910' ;
requires 'Try::Tiny' , '0.02' ;
requires 'URI::WithBase' ;
requires 'perl' , '5.008001' ;
requires 'Cookie::Baker' , '0.11' ;
requires 'Digest::SHA1' ;
requires 'Devel::StackTrace' ;
requires 'Text::SimpleTable' ;
requires 'Text::MicroTemplate' ;
recommends 'Text::Xslate' ;
recommends 'Text::MicroTemplate::Extended' , '0.09' ;
|
lib/Ark/Plugin/Session/State/Cookie.pm
view on Meta::CPAN
1 2 3 4 5 6 7 8 9 10 11 | has cookie_name => (
is => 'rw' ,
isa => 'Str' ,
lazy => 1,
default => sub {
my $self = shift ;
|
lib/Ark/Test.pm
view on Meta::CPAN
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | sub import {
my ( $class , $app_class , @rest ) = @_ ;
|
lib/Ark/Test.pm
view on Meta::CPAN
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 | }
$app ->config->{home} ||= dir( $FindBin::Bin );
}
if ( $option {reuse_connection}) {
if ( $persist_app ) {
$app = $persist_app ;
}
else {
$persist_app = $app ;
$cookie = HTTP::Cookies->new;
}
}
my $req = ref ( $_ [0]) eq 'HTTP::Request' ? $_ [0] : HTTP::Request->new( @_ );
if ( $cookie ) {
unless ( $req ->uri->can( 'host' ) and $req ->uri->host) {
$req ->header( Host => 'localhost' );
}
$cookie ->add_cookie_header( $req ) unless $req ->header( 'Cookie' );
}
my $res ;
test_psgi(
app => $app ->handler,
client => sub {
my $cb = shift ;
$res = $cb ->( $req );
},
);
|
t/plugin_csrf_defender.t
view on Meta::CPAN
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | {
use_plugins qw/
Session
Session::State::Cookie
Session::Store::Memory
CSRFDefender
/ ;
conf 'Plugin::Session::State::Cookie' => {
cookie_expires => '+3d' ,
};
has '+namespace' => default => '' ;
sub test_set :Local {
my ( $self , $c ) = @_ ;
|
t/plugin_csrf_defender_error_action.t
view on Meta::CPAN
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | {
use_plugins qw/
Session
Session::State::Cookie
Session::Store::Memory
CSRFDefender
/ ;
config 'Plugin::Session::State::Cookie' => {
cookie_expires => '+3d' ,
};
config 'Plugin::CSRFDefender' => {
error_action => '/csrf_error' ,
};
|
t/plugin_csrf_defender_filter_form.t
view on Meta::CPAN
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | {
use_plugins qw/
Session
Session::State::Cookie
Session::Store::Memory
CSRFDefender
/ ;
conf 'Plugin::Session::State::Cookie' => {
cookie_expires => '+3d' ,
};
conf 'Plugin::CSRFDefender' => {
filter_form => 1,
};
has '+namespace' => default => '' ;
|
t/plugin_csrf_defender_with_options.t
view on Meta::CPAN
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | {
use_plugins qw/
Session
Session::State::Cookie
Session::Store::Memory
CSRFDefender
/ ;
config 'Plugin::Session::State::Cookie' => {
cookie_expires => '+3d' ,
};
config 'Plugin::CSRFDefender' => {
error_code => 400,
error_output => 'ERROR!' ,
validate_only => 1,
};
|
t/plugin_session.t
view on Meta::CPAN
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | {
use_plugins qw/
Session
Session::State::Cookie
Session::Store::Memory
/ ;
conf 'Plugin::Session::State::Cookie' => {
cookie_expires => '+3d' ,
};
has '+namespace' => default => '' ;
sub test_set :Local {
my ( $self , $c ) = @_ ;
|
t/plugin_session.t
view on Meta::CPAN
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | }
}
components => [ qw/Controller::Root/ ],
reuse_connection => 1;
{
my $res = request( GET => '/test_set' );
like( $res ->header( 'Set-Cookie' ), qr/testapp_session=/ , 'session id ok' );
like( $res ->header( 'Set-Cookie' ), qr/expires=./ , 'session expire ok' );
is(get( '/test_get' ), 'dummy' , 'session get ok' );
}
subtest 'dies after finalize' => sub {
subtest "can't set" => sub {
my $c = ctx_get '/test_set' ;
local $@;
eval {
$c ->session->set( 'hoge' , 1);
|
t/plugin_session.t
view on Meta::CPAN
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 | local $@;
eval {
$c ->session->get( 'test' );
};
ok !$@;
};
};
{
my $res = request( GET => '/test_flash_set' );
like( $res ->header( 'Set-Cookie' ), qr/testapp_session=/ , 'session id ok' );
is(get( '/test_flash_get' ), 'dummy_flash' , 'flash get ok' );
is(get( '/test_flash_get' ), '' , 'flash cleaered ok' );
}
{
is(get( '/incr' ), 1, 'increment first ok' );
is(get( '/incr' ), 2, 'increment second ok' );
reset_app;
|
t/plugin_session.t
view on Meta::CPAN
123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 | }
{
reset_app;
my $res ;
$res = request( GET => '/incr' );
is $res ->content, 1, 'request ok' ;
my ( $sid ) = $res ->header( 'Set-Cookie' ) =~ /testapp_session=(\w+)/;
ok $sid , 'sid ok' ;
$res = request( GET => '/regen' );
is $res ->content, 'regenerated' , 'sid regenerated' ;
my ( $new_sid ) = $res ->header( 'Set-Cookie' ) =~ /testapp_session=(\w+)/;
is get( '/incr' ), 2, 'session continued ok' ;
isnt $sid , $new_sid , 'but session_id updated ok' ;
is get( '/regen_and_incr' ), 3, 'modified session data and regenerated sid on the same request ok' ;
my $request = HTTP::Request->new( GET => '/incr' );
$request ->header( Cookie => "testapp_session=$sid" );
is request( $request )->content, 1, 'old session already expired' ;
}
done_testing;
|
t/plugin_session_expire.t
view on Meta::CPAN
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | {
use_plugins qw/
Session
Session::State::Cookie
Session::Store::Memory
/ ;
conf 'Plugin::Session::State::Cookie' => {
cookie_expires => undef ,
};
has '+namespace' => default => '' ;
sub test_set :Local {
my ( $self , $c ) = @_ ;
|
t/plugin_session_expire.t
view on Meta::CPAN
27 28 29 30 31 32 33 34 35 36 37 38 39 40 | }
}
components => [ qw/Controller::Root/ ],
reuse_connection => 1;
{
my $res = request( GET => '/test_set' );
like( $res ->header( 'Set-Cookie' ), qr/testapp_session=/ , 'session id ok' );
unlike( $res ->header( 'Set-Cookie' ), qr/expires=/ , 'session expires ok' );
}
done_testing;
|
t/plugin_session_model.t
view on Meta::CPAN
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | {
use_plugins qw/
Session
Session::State::Cookie
Session::Store::Model
/ ;
conf 'Plugin::Session' => {
expire => 3,
};
conf 'Plugin::Session::Store::Model' => {
model => 'Session' ,
};
|
t/plugin_session_model.t
view on Meta::CPAN
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | }
}
components => [ qw/Controller::Root Model::Session/ ],
reuse_connection => 1;
{
my $res = request( GET => '/test_set' );
like( $res ->header( 'Set-Cookie' ), qr/t1_session=/ , 'session id ok' );
is(get( '/test_get' ), 'testdata' , 'session get ok' );
}
{
is(get( '/incr' ), 1, 'increment first ok' );
is(get( '/incr' ), 2, 'increment second ok' );
reset_app;
is(get( '/incr' ), 1, 're-increment first ok' );
|
t/plugin_session_state_cookie.t
view on Meta::CPAN
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | {
use_plugins qw/
Session
Session::State::Cookie
Session::Store::Memory
/ ;
conf 'Plugin::Session::State::Cookie' => {
cookie_secure => 1,
cookie_httponly => 1,
cookie_samesite => 'None' ,
};
has '+namespace' => default => '' ;
|
t/plugin_session_state_cookie.t
view on Meta::CPAN
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | }
}
components => [ qw/Controller::Root/ ],
reuse_connection => 1;
{
my $res = request( GET => '/test_set' );
like( $res ->header( 'Set-Cookie' ), qr/secure/ , 'secure is true' );
like( $res ->header( 'Set-Cookie' ), qr/HttpOnly/ , 'HttpOnly is true' );
like( $res ->header( 'Set-Cookie' ), qr/SameSite=None;/ , 'SameSite is None' );
}
done_testing;
|