Catalyst-Plugin-HashedCookies

 view release on metacpan or  search on metacpan

META.json  view on Meta::CPAN

            "warnings" : "0"
         }
      },
      "test" : {
         "requires" : {
            "Catalyst" : "0",
            "Catalyst::Controller" : "0",
            "Data::Dumper" : "0",
            "File::Spec::Functions" : "0",
            "HTTP::Headers::Util" : "0",
            "HTTP::Request::Common" : "0",
            "Scalar::Util" : "0",
            "Test::More" : "0"
         }
      }
   },
   "release_status" : "stable",
   "resources" : {
      "bugtracker" : {
         "web" : "https://rt.cpan.org/Public/Dist/Display.html?Name=Catalyst-Plugin-HashedCookies"
      },

META.yml  view on Meta::CPAN

---
abstract: 'Tamper-resistant HTTP Cookies'
author:
  - 'Oliver Gorwits <oliver@cpan.org>'
build_requires:
  Catalyst: 0
  Catalyst::Controller: 0
  Data::Dumper: 0
  File::Spec::Functions: 0
  HTTP::Headers::Util: 0
  HTTP::Request::Common: 0
  Scalar::Util: 0
  Test::More: 0
configure_requires:
  ExtUtils::MakeMaker: 6.30
dynamic_config: 0
generated_by: 'Dist::Zilla version 4.300002, CPAN::Meta::Converter version 2.131560'
license: perl
meta-spec:
  url: http://module-build.sourceforge.net/META-spec-v1.4.html
  version: 1.4

Makefile.PL  view on Meta::CPAN


my %WriteMakefileArgs = (
  "ABSTRACT" => "Tamper-resistant HTTP Cookies",
  "AUTHOR" => "Oliver Gorwits <oliver\@cpan.org>",
  "BUILD_REQUIRES" => {
    "Catalyst" => 0,
    "Catalyst::Controller" => 0,
    "Data::Dumper" => 0,
    "File::Spec::Functions" => 0,
    "HTTP::Headers::Util" => 0,
    "HTTP::Request::Common" => 0,
    "Scalar::Util" => 0,
    "Test::More" => 0
  },
  "CONFIGURE_REQUIRES" => {
    "ExtUtils::MakeMaker" => "6.30"
  },
  "DISTNAME" => "Catalyst-Plugin-HashedCookies",
  "EXE_FILES" => [],
  "LICENSE" => "perl",
  "NAME" => "Catalyst::Plugin::HashedCookies",

t/60-request_hooks.t  view on Meta::CPAN

use Test::More tests => 14;
use lib 't/lib';
require 'do_request.pl';

# Tests to check that our plugin doesn't mange cookie as it reads them.
# Note that because required defaults to 1, these cookies are processed fully.

# no need for a die() here because Cat will do that for us
BEGIN { use_ok('Catalyst::Test', ('PluginTestApp')); }

use HTTP::Request::Common;

{
    my $request = HTTP::Request::Common::GET(
        '/testrequest',
        'Cookie' => 'Catalyst=Cool; Cool=Catalyst',
    );

    my $creq = &do_request( $request );
   
    # plugin has not mangled cookies in request object
    
    isa_ok( $creq->cookies->{Catalyst}, 'CGI::Simple::Cookie',
        'Cookie "Catalyst"' );

t/70-algorithms.t  view on Meta::CPAN


use Test::More tests => 73;
use lib 't/lib';
require 'do_request.pl';

# Tests to exercise our plugin's hashing and vailidity checks

# no need for a die() here because Cat will do that for us
BEGIN { use_ok('Catalyst::Test', ('PluginTestApp')); }

use HTTP::Request::Common;

my @cookies = (
    # These first four check that the plugin strips special _hashedcookies_*
    # fields from the cookies within the Catalyst request phase, and then also
    # check that "required" defaults to '1', meaning cookies with hashes are
    # valid but those without are invalid (well, not valid, in this check).
    ['_hashedcookies_padding&one', 'one', ''],
    ['_hashedcookies_padding&one&_hashedcookies_digest&d36978d8a21991c14b9cf6d086313837f321d392', 'one', 1],
    ['one&two', 'one&two', ''],
    ['one&two&_hashedcookies_digest&c1cae8fae8a4f89541798e61d1609bea2d7d3c3a', 'one&two', 1],

t/70-algorithms.t  view on Meta::CPAN

    'one&two&_hashedcookies_digest&60c590f3c7aedb57befdcb48e4384e5f94c64393',
    'one&two&_hashedcookies_digest&60c590f3c7aedb57befdcb48e4384e5f94c64393', # nok
    'one&two',
);


{
    # four cookies to test
    for (my $i = 0; $i <= 3; ++$i) {
    
        my $request = HTTP::Request::Common::GET(
            '/',
            'Cookie' => "HC$i=". $cookies[$i]->[0],
        );

        my ($creq, $response, undef) = &do_request( $request );
        
        isa_ok( $creq->cookies->{"HC$i"}, 'CGI::Simple::Cookie',
            "Cookie \"HC$i\"" );
        is( $creq->cookies->{"HC$i"}->as_string, "HC$i=". $cookies[$i]->[1] .'; path=/',
            "Cookie \"HC$i\" handled by HashedCookies" );



( run in 0.404 second using v1.01-cache-2.11-cpan-de7293f3b23 )