Added tests to cover saml and added controller middleware

This commit is contained in:
Dan Brown
2019-11-17 19:15:37 +00:00
parent ebb3724892
commit c33ef4b9b2
3 changed files with 284 additions and 10 deletions

View File

@ -4,7 +4,6 @@ namespace BookStack\Http\Controllers\Auth;
use BookStack\Auth\Access\Saml2Service;
use BookStack\Http\Controllers\Controller;
use Illuminate\Http\Request;
class Saml2Controller extends Controller
{
@ -18,6 +17,15 @@ class Saml2Controller extends Controller
{
parent::__construct();
$this->samlService = $samlService;
// SAML2 access middleware
$this->middleware(function ($request, $next) {
if (!config('saml2.enabled')) {
$this->showPermissionError();
}
return $next($request);
});
}
/**