1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2024-11-23 11:22:33 +01:00

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
No known key found for this signature in database
GPG Key ID: 46D9F943C24A2EF9
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);
});
}
/**

View File

@ -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