piotzkhider/firebase-authentication-module

1.0.0 2019-08-28 09:03 UTC

This package is auto-updated.

Last update: 2024-04-29 04:45:01 UTC


README

Scrutinizer Code Quality Code Coverage Build Status Build Status

Japanese

Firebase Authentication Module for BEAR.Sunday

Installation

Composer install

$ composer require piotzkhider/firebase-authentication-module

Module install

use 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

@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
    {