mardi 23 avril 2019

Trying to set up CAS with my Laravel project

I am using subfission/cas for my application. I have followed all installation steps. I am using windows, if that matters. More precisely, I have configured the following:

I ran the following in my terminal

composer require "subfission/cas" "dev-master"

I configured my Kernel.php accordingly, adding the following:

'cas.auth'  => 'Subfission\Cas\Middleware\CASAuth',
'cas.guest' => 'Subfission\Cas\Middleware\RedirectCASAuthenticated',

I ran the following command:

php artisan vendor:publish

I also set up my cas server in my cas.php config file:

'cas_hostname'        => env('CAS_HOSTNAME', 'cas.myserver.me'),
'cas_real_hosts'      => env('CAS_REAL_HOSTS', 'cas.myserver.me'),

What I want is a middleware for all my routes, so I added the following route rule in my routes:

Route::middleware(['cas.auth'])->group(function ()
{
    Route::get('/', function ()
    {
        return view('welcome');
    });
});

Basically, I want to redirect everyone who is not logged in to the login page whenever I access the main page (for now, I will add more routes in the future). What happens is that the users are redirected to the login page when they are not logged in, but after the login I receive the following error:

ErrorException (E_WARNING) DOMDocument::loadXML(): Opening and ending tag mismatch: hr line 1 and body in Entity, line: 1

No matter what view I'm redirecting the user to. I tried the default welcome page as well as an empty view, but I still get the same error.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire