aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/App/Engine.pm
diff options
context:
space:
mode:
authorMatthew Somerville <matthew-github@dracos.co.uk>2018-01-23 13:25:15 +0000
committerMatthew Somerville <matthew-github@dracos.co.uk>2018-01-23 13:25:15 +0000
commit6e415f3c6d9355312b9fb84e4ecdb68f96cff618 (patch)
tree9e0c21f5408a7bb93007456673cb0b420855b977 /perllib/FixMyStreet/App/Engine.pm
parent4aa74d4dc2208a4465d9e25921c4bfa3ec14c24a (diff)
Remove SameSite=Lax from cookies.
Diffstat (limited to 'perllib/FixMyStreet/App/Engine.pm')
-rw-r--r--perllib/FixMyStreet/App/Engine.pm68
1 files changed, 0 insertions, 68 deletions
diff --git a/perllib/FixMyStreet/App/Engine.pm b/perllib/FixMyStreet/App/Engine.pm
deleted file mode 100644
index b73701f49..000000000
--- a/perllib/FixMyStreet/App/Engine.pm
+++ /dev/null
@@ -1,68 +0,0 @@
-package FixMyStreet::App::Engine;
-
-use Moose;
-extends 'Catalyst::Engine';
-
-use CGI::Cookie;
-use utf8;
-
-use namespace::clean -except => 'meta';
-
-=head1 NAME
-
-FixMyStreet::App::Engine - Catalyst Engine wrapper
-
-=head1 SYNOPSIS
-
-See L<Catalyst::Engine>.
-
-=head1 METHODS
-
-=head2 $self->finalize_cookies($c)
-
-Create CGI::Cookie objects from C<< $c->res->cookies >>, and set them as
-response headers. Adds a C<samesite=lax> part.
-
-=cut
-
-sub finalize_cookies {
- my ( $self, $c ) = @_;
-
- my @cookies;
- my $response = $c->response;
-
- foreach my $name (keys %{ $response->cookies }) {
-
- my $val = $response->cookies->{$name};
-
- my $cookie = (
- blessed($val)
- ? $val
- : CGI::Cookie->new(
- -name => $name,
- -value => $val->{value},
- -expires => $val->{expires},
- -domain => $val->{domain},
- -path => $val->{path},
- -secure => $val->{secure} || 0,
- -httponly => $val->{httponly} || 0,
- -samesite => 'Lax',
- )
- );
- if (!defined $cookie) {
- $c->log->warn("undef passed in '$name' cookie value - not setting cookie")
- if $c->debug;
- next;
- }
-
- push @cookies, $cookie->as_string;
- }
-
- for my $cookie (@cookies) {
- $response->headers->push_header( 'Set-Cookie' => $cookie );
- }
-}
-
-__PACKAGE__->meta->make_immutable;
-
-1;