First of all, sorry for my English, I will try to do my best.
Im new for Laravel, im trying to implement user authentication through SOAP WS, I declare a new class that implements UserProviderInterface. I successfully execute the retrieveByCredentials and validateCredentials methods, but since I do not have access to the database or global user information, I cannot implement the retrieveByID method. Is there a way to make user Auth not based on user id?
I need:
- Login and validate user throught SOAP WS - Store User Info returned by WS. - Remember me functionality - Secure routes based on logged user and level of access - Logout
Implemented Class:
<?php namespace Spt\Common\Providers; use Illuminate\Auth\UserProviderInterface; use Illuminate\Auth\GenericUser; use Illuminate\Auth\UserInterface; class AuthUserProvider implements UserProviderInterface{ private $user; public function __construct(){ $this->user = null; } public function retrieveByID($identifier){ return $this->user; } public function retrieveByCredentials(array $credentials){ $client = new \SoapClient('webserviceurl'); $res = $client->Validar_Cliente($credentials); $res = $res->Validar_ClienteResult; if($res->infoError->bError === true){ return; } $res->id = $res->id_cliente; $user = new GenericUser((array) $res); return $user; } public function validateCredentials(UserInterface $user, array $credentials){
I think UserProviderInterface its not a solution, but I googled and didn't find another way
Any idea?
source share