我在我的Symfony2的项目实施HWIOauhBundle。 除了使用不同的语言环境中的一切工作正常。 我的默认语言环境是“FR”。 当登录和使用“EN”的语言环境,了连接工作正常,但我重定向到相应的网页“fr”区域(该网页是default_target_path)。 我只使用谷歌登录。
任何建议?
我的配置如下:
应用程序/配置/ routing.yml中:
hwi_oauth_redirect:
resource: "@HWIOAuthBundle/Resources/config/routing/redirect.xml"
prefix: /{_locale}/connect
hwi_oauth_login:
resource: "@HWIOAuthBundle/Resources/config/routing/login.xml"
prefix: /{_locale}/login-oauth
hwi_oauth_connect:
resource: "@HWIOAuthBundle/Resources/config/routing/connect.xml"
prefix: /{_locale}/connect
google_login:
pattern: /login/check-google
应用程序/配置/ config.yml
# HWIOauth Configuration
hwi_oauth:
#
firewall_name: main
resource_owners:
google:
type: google
client_id: xxxxxxxxx
client_secret: yyyyyyyyy
scope: "email profile"
fosub:
# try 30 times to check if a username is available (foo, foo1, foo2 etc)
username_iterations: 30
# mapping between resource owners and properties
properties:
google: googleId
connect:
confirmation: true
应用程序/配置/ security.yml
security:
encoders:
My\UserBundle\Entity\User: sha512
role_hierarchy:
ROLE_ADMIN: [ROLE_AUTEUR, ROLE_MODERATEUR]
ROLE_SUPER_ADMIN: [ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH]
providers:
fos_userbundle:
id: fos_user.user_provider.username_email
firewalls:
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false
main:
pattern: ^/
anonymous: true
#provider: hwi
provider: fos_userbundle
form_login:
login_path: fos_user_security_login
check_path: fos_user_security_check
default_target_path: mybundle_homepage
csrf_provider: form.csrf_provider
logout:
path: fos_user_security_logout
target: mybundle_homepage
handlers: [mybundle.logout_handler]
remember_me:
key: %secret%
lifetime: 31536000
oauth:
resource_owners:
google: google_login
login_path: hwi_oauth_connect
use_forward: false
failure_path: hwi_oauth_connect
default_target_path: mybundle_homepage
oauth_user_provider:
service: mybundle_user.provider.fosub_bridge
access_control:
#- { path: ^/login, roles: IS_AUTHENTICATED_ANONYMOUSLY, requires_channel: https }
谷歌Developpers控制台:重定向的URI
http://myhost/web/app_dev.php/connect/service/google
http://myhost/web/app_dev.php/login/check-google