By passing Sentry 2 authentication

411 Views Asked by At

I'm using Sentry2 for my authentication in a laravel 4 application.

http://docs.cartalyst.com/sentry-2/authentication

The specifications want the ability to "pretend" to be another user. For example, the super administrator can pretend to be any users.

Anybody have any idea how to do this? I've read the manual and it doesn't look like there is anyway to spoof the Sentry::authenticate() function.

1

There are 1 best solutions below

1
On

It looks like I'm able to use the Sentry::login() method instead of the authenticate() method

$user = User::find($user_id);
$sentryUser = Sentry::getUserProvider()->findById($user->id);
Sentry::login($sentryUser);