Created
December 1, 2020 23:20
-
-
Save chriscalip/47ef8cab4dac32e5638c37b2e2389925 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Drupal\xxx\Authentication\Provider; | |
use Drupal\Core\Authentication\AuthenticationProviderInterface; | |
use Symfony\Component\HttpFoundation\Request; | |
use Drupal\Core\Session\AccountProxyInterface; | |
/** | |
* Allow all authentication provider. | |
*/ | |
class AllowAllAuth implements AuthenticationProviderInterface { | |
/** | |
* {@inheritdoc} | |
*/ | |
public function applies(Request $request) { | |
return TRUE; | |
} | |
/** | |
* {@inheritdoc} | |
*/ | |
public function authenticate(Request $request) { | |
return $this->currentUser->getAccount(); | |
// return NULL; | |
} | |
/** | |
* {@inheritdoc} | |
*/ | |
protected $currentUser; | |
/** | |
* {@inheritdoc} | |
*/ | |
public function __construct(AccountProxyInterface $currentUser) { | |
$this->currentUser = $currentUser; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment