-sub authenticate {
- my ($user, $pass, $env) = @_;
- return unless eval {
- pwcheck $user, $pass;
- 1
- };
-
- return if $env->{'gruntmaster.reqadmin'} && !hascaps $user, 'gmadm';
- 1
+sub add_headers {
+ my $app = $_[0];
+ sub {
+ my $resp = $app->($_[0]);
+ my $hdrs = Plack::Util::headers($resp->[1]);
+ $hdrs->set('Content-Security-Policy', CONTENT_SECURITY_POLICY);
+ $hdrs->set('Link', '</static/cyborg.css>; rel=stylesheet') if $hdrs->get('Content-Type') =~ m,^text/html,;
+ $hdrs->set('Cache-Control', 'public, max-age=604800') if $_[0]->{PATH_INFO} =~ qr,^/static/,;
+ $resp->[1] = $hdrs->headers;
+ $resp;
+ }