Support the ongoing development of Laravel.io →
Configuration Authentication Session
Last updated 2 years ago.
0

I'm not sure how to implement that into Laravel. This is the issue. I can write code for what needs to happen, just not sure how to write it for Laravel.

0

I had to do something similar recently.

My situation was pretty specific but you could set this up as middleware.

I use Laravel Authentication in conjunction with AD, avery simplified process below

First i check if we have authenticated the user in laravel with

\Auth::check()

If not I check for the $_SERVER['AUTH_USER'].

$id = isset($_SERVER['AUTH_USER'] ? $_SERVER['AUTH_USER'] : false;

If this is set I see if we have the user in Laravel

$user = \User::find($id);

If the user exists I log them in

\Auth::login($user);

If not I create a new user and then log them in.

$user = new \User;
$user->id = $id;
$user->password = 'dummy';
$user->save();
\Auth::login($user);

if the $_SERVER['AUTH_USER'] is not set then I redirect to the log-in page.

0

Sign in to participate in this thread!

Eventy

Your banner here too?

Clarkey clarkey Joined 11 Mar 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.