I would like to convert the current authentication project to use saml2 and I am still in the learning process to do it.
The Routes:Auth is using middleware Auth, so we will no longer be using that. However when i add function handle in App/Http/Middleware/RedirectIfAuthenticated.php i got error message:
Symfony\Component\Routing\Exception\RouteNotFoundException
Route [login] not defined.
This is code for web.php
//Auth::routes();
Route::get('/home', 'HomeController@index')->name('home');
This is code RedirectIfAuthenticated.php code as per suggested
use Aacotroneo\Saml2\Saml2Auth;
public function handle($request, Closure $next, $guard = null)
{
if (Auth::guard($guard)->check()) {
return redirect('/home');
}
if (Auth::guest())
{
if ($request->ajax())
{
return response('Unauthorized.', 401);
}
else
{
$saml2Auth = new Saml2Auth(Saml2Auth::loadOneLoginAuthFromIpdConfig('sso'));
return $saml2Auth->login(URL::full());
}
}
return $next($request);
}
Shoud we turn off the auth mddleware and how we should go about it?
Hello,
I would like to convert the current authentication project to use saml2 and I am still in the learning process to do it.
The Routes:Auth is using middleware Auth, so we will no longer be using that. However when i add function handle in App/Http/Middleware/RedirectIfAuthenticated.php i got error message:
Symfony\Component\Routing\Exception\RouteNotFoundException Route [login] not defined.
This is code for web.php //Auth::routes(); Route::get('/home', 'HomeController@index')->name('home');
This is code RedirectIfAuthenticated.php code as per suggested use Aacotroneo\Saml2\Saml2Auth;
public function handle($request, Closure $next, $guard = null) { if (Auth::guard($guard)->check()) { return redirect('/home'); }
Shoud we turn off the auth mddleware and how we should go about it?
Any idea? Thanks