Firebase Authentication Module for BEAR.Sunday
$ composer require piotzkhider/firebase-authentication-moduleuse Piotzkhider\FirebaseAuthenticationModule\FirebaseAuthenticationModule;class AppModule extends AbstractAppModule
{
/**
* {@inheritdoc}
*/
protected function configure()
{
$appDir = $this->appMeta->appDir;
require_once $appDir . '/env.php';
...
$this->install(new FirebaseAuthenticationModule(getenv('GOOGLE_APPLICATION_CREDENTIALS')));
...
}
}@Authenticate is a annotation for authentication.
Authentication process is executed before process the method.
class Tasks extends ResourceObject
{
/**
* @Authenticate
*/
public function onGet(): ResourceObject
{The authenticated user can be defined directly as a method argument.
For that purpose it need specified in @Authenticate attribute.
And it set null of default parameter in last of arguments like @Assisted.
class Tasks extends ResourceObject
{
/**
* @Authenticate(user="user")
*/
public function onGet(UserRecord $user = null): ResourceObject
{

