<?php
namespace Cassette;
class Authentication{
function __construct($user)
{
$this->user = $user;
}
function __invoke($request,$response,$next)
{
// not logged
if( empty($this->user) )
{
return $response->withHeader('Location','/');//->withStatus(403);
}
return $next($request,$response);
}
}
?>