Added tests to cover saml and added controller middleware
This commit is contained in:
parent
ebb3724892
commit
c33ef4b9b2
3 changed files with 284 additions and 10 deletions
|
@ -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);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -217,7 +217,6 @@ Route::get('/register/confirm/{token}', 'Auth\ConfirmEmailController@confirm');
|
|||
Route::post('/register', 'Auth\RegisterController@postRegister');
|
||||
|
||||
// SAML routes
|
||||
// TODO - Prevent access without SAML2 enabled via middleware
|
||||
Route::get('/saml2/login', 'Auth\Saml2Controller@login');
|
||||
Route::get('/saml2/logout', 'Auth\Saml2Controller@logout');
|
||||
Route::get('/saml2/metadata', 'Auth\Saml2Controller@metadata');
|
||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue