rybakdigital/authentication-bundle

认证包

v1.0.0 2016-11-02 09:46 UTC

This package is auto-updated.

Last update: 2024-09-08 06:59:33 UTC


README

Build Status CircleCI

安装

将依赖项添加到您的composer中

composer require rybakdigital/authentication-bundle:^1.0

配置

将rybakdigital/authetication服务添加到导入服务的列表中

# services.yml
imports:
    ...
    - { resource: "@RybakDigitalAuthenticationBundle/Resources/config/services.yml" }

配置您的安全策略

# security.yml
...
    guard:
        authenticators:
            # Add app token authenticator if you need to use one
            - rybakdigital.authentication.api.app_token.header_authenticator
            # Add user token authenticator if you need to use one
            - rybakdigital.authentication.api.app_user_token.header_authenticator

AppToken 与 UserToken

AppToken

使用app token进行应用程序认证。您的用户提供者必须实现AppTokenAuthorizableInterface接口。认证器将尝试调用getApiKey()方法以认证应用程序。

UserToken

使用app token对特定用户进行认证。您的用户提供者必须实现AppUserInterface接口。认证器将尝试调用loadApiAppByName($name)方法以通过$name提供者获取用户。注意在这种情况下,应用程序名称变成了用户名。