| File: | blib/lib/Database/BI/Sessions.pm |
| Coverage: | 100.0% |
| line | stmt | bran | cond | sub | time | code |
|---|---|---|---|---|---|---|
| 1 | package Database::BI::Sessions; | |||||
| 2 | ||||||
| 3 | 127 127 127 | 210 942 861 | use strict; | |||
| 4 | 127 127 127 | 174 83 2297 | use warnings; | |||
| 5 | ||||||
| 6 | our $VERSION = '0.025.0'; | |||||
| 7 | ||||||
| 8 | 127 127 127 | 133 75 385 | use Mojo::Base 'Mojolicious::Sessions'; | |||
| 9 | ||||||
| 10 | # The login cookie is marked Secure on a reply to a request that came over | |||||
| 11 | # https, so the browser never sends it back over http, where anyone on the | |||||
| 12 | # path could read it and log in as the reader. Mojolicious::Sessions has one secure | |||||
| 13 | # setting for the whole application; a server reached both ways (or a proxy | |||||
| 14 | # that says X-Forwarded-Proto: https) needs it per request. Over plain http | |||||
| 15 | # the cookie cannot be Secure, or the browser would drop it and the login | |||||
| 16 | # would never stick. | |||||
| 17 | sub store { | |||||
| 18 | 5048 | 38388177 | my ($self, $c) = @_; | |||
| 19 | 5048 | 11493 | local $self->{secure} = $self->{secure} || $c->req->is_secure; | |||
| 20 | 5048 | 64789 | return $self->SUPER::store($c); | |||
| 21 | } | |||||
| 22 | ||||||
| 23 | 1; | |||||
| 24 | ||||||