【发布时间】:2019-04-17 09:54:02
【问题描述】:
我已经创建了一个 Symfony 4.2 应用程序,我想在其中添加 Microsoft 身份验证,所以在网络上进行了多次研究后,我发现了一个名为 HWIOAuthBundle 的库,我已经按照每一步进行操作,但我仍然有问题
如果有人可以帮助我,那将非常有帮助
hwi_oauth.yaml 文件:
#/config/packages/hwi_oauth.yaml
hwi_oauth:
# list of names of the firewalls in which this bundle is active, this setting MUST be set
firewall_names: [secured_area]
# https://github.com/hwi/HWIOAuthBundle/blob/master/Resources/doc/2-configuring_resource_owners.md
resource_owners:
azure:
type: azure
client_id: '%env(AZURE_ID)%'
client_secret: '%env(AZURE_SECRET)%'
options:
resource: https://graph.windows.net
application: common
这是我的安全文件:
#/config/packages/security.yaml
security:
# https://symfony.com/doc/current/security.html#where-do-users-come-from-user-providers
providers:
in_memory: { memory: ~ }
firewalls:
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false
secured_area:
anonymous: true
oauth:
resource_owners:
azure: "/login/check-azure"
login_path: /login
use_forward: false
failure_path: /login
oauth_user_provider:
service: my.oauth_aware.user_provider.service
# activate different ways to authenticate
# http_basic: true
# https://symfony.com/doc/current/security.html#a-configuring-how-your-users-will-authenticate
# form_login: true
# https://symfony.com/doc/current/security/form_login_setup.html
# Easy way to control access for large sections of your site
# Note: Only the *first* access control that matches will be used
access_control:
- { path: ^/login, roles: IS_AUTHENTICATED_ANONYMOUSLY }
# - { path: ^/admin, roles: ROLE_ADMIN }
# - { path: ^/profile, roles: ROLE_USER }
我运行 php bin/console server:run 时的错误:
The service "hwi_oauth.authentication.provider.oauth.secured_area" has a dependency on a non-existent ser
vice "my.oauth_aware.user_provider.service".
提前致谢
斯托菲尔
【问题讨论】:
标签: php azure symfony authentication hwioauthbundle