Activator
view release on metacpan or search on metacpan
lib/Catalyst/Plugin/SecureCookies.pm view on Meta::CPAN
=head1 NAME
Catalyst::Plugin::SecureCookies - Tamper-resistant, encrypted HTTP Cookies
=head1 SYNOPSIS
use Catalyst qw/SecureCookies/;
MyApp->config->{SecureCookies} = {
key => $blowfish_key,
ssl => 1 # send the checksum over ssl
};
MyApp->setup;
# later, in another part of MyApp...
$c->request->exp_secure_cookies( $expiration );
$c->request->set_secure_cookie( 'my_cookie_name', $value );
my $secure_data = $c->request->get_secure_cookie('my_cookie_name');
=head1 DESCRIPTION
lib/Catalyst/Plugin/SecureCookies.pm view on Meta::CPAN
=item key
MyApp->config->{SecureCookies}->{key} = $secret_key;
This parameter is B<required>, and sets the secret key that is used to
encrypt the cookies with Crypt::CBC Blowfish. This needs to be a
16 hex character string.
=item ssl
MyApp->config->{SecureCookies}->{ssl} = 0;
# or
MyApp->config->{SecureCookies}->{ssl} = 1;
This parameter is optional, and will default to C<1> if not set.
If C<1>, the checksum or hash cookie will be sent over SSL for
added security. This will prevent replay attacks from being
used against the server.
If C<0>, the checksum will be sent as a normal, non-secure cookie.
=back
lib/Catalyst/Plugin/SecureCookies.pm view on Meta::CPAN
};
## set the cookie exp time
*{Symbol::qualify_to_ref('exp_secure_cookies', 'Catalyst::Response')} =
Class::Accessor::Fast::make_accessor('Catalyst::Request', 'exp_secure_cookies');
sub setup {
my $self = shift;
$self->config->{SecureCookies}->{ssl} ||= 1;
return $self->NEXT::setup(@_);
}
# remove and check hash in Cookie Values
sub prepare_cookies {
my $c = shift;
$c->NEXT::prepare_cookies(@_);
lib/Catalyst/Plugin/SecureCookies.pm view on Meta::CPAN
foreach my $key (keys %$sco) {
if( ! defined($sc->{$key}) ) {
$sc->{$key} = $sco->{$key};
}
}
}
## first encode the form
my ($encoded, $csum) = &_encrypt( $c, $sc );
## ssl, yes or no?
my $ssl = $c->config->{SecureCookies}->{ssl};
my $ssl_val = $ssl ? 1 : 0;
## expiration?
my $exp = $c->response->exp_secure_cookies();
## make the two cookies
$c->response->cookies->{rJ} = { value => $encoded,
expires => $exp };
$c->response->cookies->{rC} = { value => $csum,
expires => $exp };
share/apache2/conf/httpd.conf.tt view on Meta::CPAN
#
# You may use the command line option '-S' to verify your virtual host
# configuration.
#
# Use name-based virtual hosting.
#
#NameVirtualHost *:80
#
# NOTE: NameVirtualHost cannot be used without a port specifier
# (e.g. :80) if mod_ssl is being used, due to the nature of the
# SSL protocol.
#
#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for requests without a known
# server name.
#
#<VirtualHost *:80>
( run in 1.208 second using v1.01-cache-2.11-cpan-acf6aa7dc9e )