piotzkhider / firebase-authentication-module
1.0.0
2019-08-28 09:03 UTC
Requires
- php: >=7.1.0
- bear/resource: ^1.13
- piotzkhider/firebase-module: ^1.0
- ray/aura-web-module: ^0.1.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.11
- phpmd/phpmd: ^2.6
- phpstan/phpstan-shim: ^0.10.2
- phpunit/phpunit: ^7.5
- squizlabs/php_codesniffer: ^3.2
This package is auto-updated.
Last update: 2024-09-29 05:29:33 UTC
README
Firebase Authentication Module for BEAR.Sunday
安装
Composer安装
$ composer require piotzkhider/firebase-authentication-module
模块安装
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
是一个用于身份验证的注解。
身份验证过程在处理方法之前执行。
class Tasks extends ResourceObject { /** * @Authenticate */ public function onGet(): ResourceObject {
已验证用户可以直接定义为方法参数。
为此,需要在 @Authenticate
属性中指定。并且它将最后一个参数的默认参数设置为 null
,类似于 @Assisted
。
class Tasks extends ResourceObject { /** * @Authenticate(user="user") */ public function onGet(UserRecord $user = null): ResourceObject {