这是我的routing.yml:
index=mylog API=Order orderid=
[ search index=mylog "trigger.rule: Id - * : Unexpected System Error"
| rex "Id - (?<myorderid>[^:]*)" | fields myorderid ]
这是我完整的安全性。yml:
hwi_oauth_redirect:
resource: "@HWIOAuthBundle/Resources/config/routing/redirect.xml"
prefix: /connect
hwi_oauth_connect:
resource: "@HWIOAuthBundle/Resources/config/routing/connect.xml"
prefix: /connect
hwi_oauth_login:
resource: "@HWIOAuthBundle/Resources/config/routing/login.xml"
prefix: /login
elama.facebook_login:
path: /login/check-facebook
#the rest of the file are my services
在我的config.yml中,有以下部分:
security:
providers:
database:
id: elama.user.user_provider
firewalls:
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false
private_api:
pattern: ^/private_api/
security: false
client_area:
context: client_area
provider: database
pattern: ^/
anonymous: ~
elama: true
logout:
path: /logout
target: /
success_handler: elama.auth_event_listener
oauth:
resource_owners:
facebook: "/login/check-facebook"
login_path: /login
use_forward: false
failure_path: /login?failed=true
oauth_user_provider:
service: 'elama.user.user_provider'
access_control:
- { path: ^/login, roles: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/system, roles: [ROLE_ADMIN, ROLE_CONTROL_PANEL_USERS] }
role_hierarchy:
ROLE_ADMIN: [ROLE_ALPHA, ROLE_BETA]
当我转到hwi_oauth:
firewall_names: [client_area]
resource_owners:
facebook:
type: facebook
client_id: '%hwioauth.facebook.client_id%'
client_secret: '%hwioauth.facebook.client_secret%'
options:
csrf: true
display: popup #dialog is optimized for popup window
auth_type: rerequest # Re-asking for Declined Permissions
时,我得到了Facebook身份验证页面,提交后会将我重定向到https://my_host/connect/facebook
。为了排除UserNotFoundException的异常,我使/login?failed=true#_=_
服务(实现了必需的elama.user.user_provider
接口)返回实际的现有用户实例(硬编码以强制返回用户实例),但这并没有帮助。更新:之所以失败,是因为我错过了从OAuthAwareUserProviderInterface
返回的对象类型:它是自定义的User对象,不符合UserInterface。
我的目标是获得以下用户工作流程: