micayael / autheticator-client-bundle
Authenticator 客户端
v1.0.2
2017-12-15 16:16 UTC
Requires
- csa/guzzle-bundle: ^2.0
- lcobucci/jwt: ^3.2
- sensio/framework-extra-bundle: ^3.0.2
- symfony/symfony: 3.3.*
This package is auto-updated.
Last update: 2024-09-29 04:03:32 UTC
README
安装 bundle
将 bundle 添加到 composer.json
"require": {
...
"micayael/autheticator-client-bundle": "^1.0.0"
},
在 AppKernel.php 中激活 bundle
$bundles = [
...
new Csa\Bundle\GuzzleBundle\CsaGuzzleBundle(),
new Micayael\Authenticator\ClientBundle\AuthenticatorClientBundle(),
...
];
配置 Guzzle 以查询 authenticator 服务
csa_guzzle:
profiler: '%kernel.debug%'
logger: true
clients:
authenticator:
config:
base_uri: https://:8001
headers:
"Content-Type": application/json
配置 bundle
要查看配置文档,请运行:bin/console config:dump-reference authenticator_client
authenticator_client:
host: http://IP:PORT
token_uri: /api/jwt/token # opcional
default_target_route: admin # opcional, default: admin
change_password_url: http://authenticator_url/admin/resetting/request
type: basic_auth
basic_auth:
username: app1
password: app1
或
authenticator_client:
host: http://IP:PORT
change_password_url: http://authenticator_url/admin/resetting/request
type: app_id
app_id: app2_id_test
发布 assets
bin/console assets:install --relative --symlink
导入 routing.yml 文件中的路由
authenticator:
resource: "@AuthenticatorClientBundle/Resources/config/routing.yml"
prefix: /
配置 security
providers:
authenticator:
id: 'authenticator_client.authenticator_user_provider'
encoders:
AppBundle\Security\User\AuthenticatorUser: plaintext
firewalls:
main:
anonymous: ~
logout:
path: /logout
guard:
authenticators:
- 'authenticator_client.login_form_authenticator'
access_control:
- { path: ^/login, roles: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/admin, roles: ROLE_USER }
额外文档
- 要定义会话寿命和名称,请参阅:https://symfony.com.cn/doc/current/reference/configuration/framework.html#session
- 如果发生错误,可以将 csa_guzzle 配置指向 authenticator 开发环境的基本 URL:https://:8001/app_dev.php。要查看数据,可以在客户端应用的 config_dev.yml 中更改配置,以便拦截重定向:intercept_redirects: true