Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1 +1 @@
* @auth0/sdk-team-approvers
* @auth0/dx-sdks-approver
23 changes: 6 additions & 17 deletions src/Auth0/Login/Auth0Service.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@

namespace Auth0\Login;

use Auth0\SDK\API\Helpers\State\SessionStateHandler;
use Auth0\SDK\API\Helpers\State\StateHandler;
use Auth0\SDK\Auth0;
use Auth0\SDK\Helpers\Cache\CacheHandler;
use Auth0\SDK\JWTVerifier;
use Auth0\SDK\Store\StoreInterface;
use Config;
use Illuminate\Contracts\Config\Repository;
use Illuminate\Contracts\Container\BindingResolutionException;
use Illuminate\Http\RedirectResponse;

Expand All @@ -31,28 +30,18 @@ class Auth0Service
*
* @param array $auth0Config
* @param StoreInterface $sessionStorage
* @param StateHandler|null $stateHandler
*
* @throws \Auth0\SDK\Exception\CoreException
*/
public function __construct(
array $auth0Config = null,
StoreInterface $sessionStorage = null,
SessionStateHandler $sessionStateHandler = null
array $auth0Config,
StoreInterface $sessionStorage,
StateHandler $stateHandler
)
{
// Backwards compatible fallbacks
if (!$auth0Config instanceof Repository && !is_array($auth0Config)) {
$auth0Config = config('laravel-auth0');
}
if (!$sessionStorage instanceof StoreInterface) {
$sessionStorage = new LaravelSessionStore();
}
if (!$sessionStateHandler instanceof SessionStateHandler) {
$sessionStateHandler = new SessionStateHandler($sessionStorage);
}

$auth0Config['store'] = $sessionStorage;
$auth0Config['state_handler'] = $sessionStateHandler;
$auth0Config['state_handler'] = $stateHandler;
$this->auth0 = new Auth0($auth0Config);
}

Expand Down
3 changes: 2 additions & 1 deletion src/Auth0/Login/LoginServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use Auth0\SDK\API\Helpers\ApiClient;
use Auth0\SDK\API\Helpers\InformationHeaders;
use Auth0\SDK\API\Helpers\State\SessionStateHandler;
use Auth0\SDK\API\Helpers\State\StateHandler;
use Auth0\SDK\Store\StoreInterface;
use Illuminate\Support\ServiceProvider;

Expand Down Expand Up @@ -49,7 +50,7 @@ public function register()
return new LaravelSessionStore();
});

$this->app->bind(SessionStateHandler::class, function ($app) {
$this->app->bind(StateHandler::class, function ($app) {
return new SessionStateHandler($app->make(LaravelSessionStore::class));
});

Expand Down