mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-07-28 17:02:04 +03:00
Added role based MFA control
- Added new DB column for control and role updated create/update actions. - Created new middleware as a start to actual enforcement logic. - Added indicator to role list of whether MFA is enforced.
This commit is contained in:
24
app/Http/Middleware/EnforceMfaRequirements.php
Normal file
24
app/Http/Middleware/EnforceMfaRequirements.php
Normal file
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace BookStack\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
|
||||
class EnforceMfaRequirements
|
||||
{
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle($request, Closure $next)
|
||||
{
|
||||
$mfaRequired = user()->roles()->where('mfa_enforced', '=', true)->exists();
|
||||
// TODO - Run this after auth (If authenticated)
|
||||
// TODO - Redirect user to setup MFA or verify via MFA.
|
||||
// TODO - Store mfa_pass into session for future requests?
|
||||
return $next($request);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user