Skip to content

Instantly share code, notes, and snippets.

@chriscalip
Created December 1, 2020 23:20
Show Gist options
  • Save chriscalip/47ef8cab4dac32e5638c37b2e2389925 to your computer and use it in GitHub Desktop.
Save chriscalip/47ef8cab4dac32e5638c37b2e2389925 to your computer and use it in GitHub Desktop.
<?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