[英]HWIOauthBundle - Facebook Login - Symfony3
我已经将HWIOauthBundle + FOSUserBundle实现到我的应用程序中,部分工作正常。
使用和不使用facebook时,登录工作正常,但如果我使用不存在或密码错误的用户正常登录,则会将我重定向到/ connect route(因为HWIOauthBundle)。
我怎么解决这个问题? 如果出现问题,请查看FOSUserBundle返回的/ login_check。 我不想用facebook登录。
我的security.yml代码:
# To get started with security, check out the documentation:
# http://symfony.com/doc/current/book/security.html
security:
encoders:
FOS\UserBundle\Model\UserInterface: bcrypt
role_hierarchy:
ROLE_ADMIN: ROLE_USER
ROLE_SUPER_ADMIN: ROLE_ADMIN
providers:
fos_userbundle:
id: fos_user.user_provider.username_email
firewalls:
# disables authentication for assets and the profiler, adapt it according to your needs
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false
main:
pattern: ^/
form_login:
provider: fos_userbundle
csrf_token_generator: security.csrf.token_manager
oauth:
resource_owners:
facebook: '/login'
login_path: /connect
failure_path: /connect
oauth_user_provider:
service: hwi_oauth.user.provider.fosub_bridge
logout: true
anonymous: true
remember_me:
secret: '%secret%'
lifetime: 604800 # 1 week in seconds
path: /
# by default, the feature is enabled by checking a
# checkbox in the login form (see below), uncomment the
# following line to always enable it.
#always_remember_me: true
access_control:
- { path: ^/login$, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/register$, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/resetting$, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/admin, roles: ROLE_ADMIN }
- { path: ^/shipment, roles: ROLE_USER }
我的routing.yml代码:
# app/config/routing.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: /connect
facebook_login:
path: /login/check-facebook
# main login.
AppBundle:
resource: "@AppBundle/Controller/"
type: annotation
FrontendBundle:
resource: "@FrontendBundle/Controller/"
type: annotation
FOSUserBundle:
resource: "@FOSUserBundle/Resources/config/routing/all.xml"
FOSMessageBundle:
resource: "@FOSMessageBundle/Resources/config/routing.xml"
prefix: /messenger
MyDinxxUserBundle:
resource: "@UserBundle/Controller/"
type: annotation
请尝试在security.yml中将facebook路径从'/ login'更改为'/ login / check-facebook'。
oauth:
resource_owners:
facebook: '/login/check-facebook'
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.