场景:
我正在使用一个包(FOSFacebookBundle),它允许我在我的配置中为一个facebook应用设置参数.一切都很好,但现在我不仅需要设置一个应用程序,还需要设置多个应用程序.
我的方法:
我创建了一个AcmeFacebookBundle,它允许在一个数组中定义多个应用程序(在Acme\FacebookBundle\DependencyInjection\Configuration中定义配置),如下所示:
acme_facebook:
apps:
some_competition:
server_url: %acme.facebook.some_competition.server_url%
file: %kernel.root_dir%/../vendor/facebook/php-sdk/src/base_facebook.php
alias: facebook
app_id: %acme.facebook.some_competition.app_id%
secret: % acme .facebook.some_competition.secret%
cookie: true
permissions: [email, user_birthday, user_location]
some_other_competition:
server_url: %acme.facebook. some_other_competition.server_url%
file: %kernel.root_dir%/../vendor/facebook/php-sdk/src/base_facebook.php
alias: facebook
app_id: %acme.facebook. some_other_competition.app_id%
secret: % acme .facebook. some_other_competition.secret%
cookie: true
permissions: [email, user_birthday, user_location]
Run Code Online (Sandbox Code Playgroud)
在Acme\FacebookBundle\DependencyInjection\AcmeFacebookExtension中,我然后循环遍历所有应用程序.我们的想法是将server_url参数与当前URL进行比较,并使用我的覆盖fos_facebook配置.
class AcmeFacebookExtension extends Extension
{
...
/**
* {@inheritDoc}
*/
public function load(array $configs, ContainerBuilder $container)
{
$configuration = new Configuration();
$config = $this->processConfiguration($configuration, $configs);
foreach …
Run Code Online (Sandbox Code Playgroud) 我在Symfony 2.3中使用FOSFacebookBundle,正如它在与FOSUserBundle文档的集成中所说的那样.编辑security.yml
,运行代码,但我收到错误:
Warning: SessionHandler::write(): Parent session handler is not open in /var/www/my/app/cache/dev/classes.php line 407
Run Code Online (Sandbox Code Playgroud)
所以我给了权限:
sudo chmod 777 -R app/cache
sudo chmod 777 -R app/logs
Run Code Online (Sandbox Code Playgroud)
当我再次登录,然后注销页面时,我得到了同样的错误.
我看到这个https://github.com/symfony/symfony/issues/5868并更新了php.
但是这个问题没解决我不知道为什么?有谁知道请告诉我?
security.yml
security:
encoders:
FOS\UserBundle\Model\UserInterface: sha512
role_hierarchy:
ROLE_ADMIN: ROLE_USER
ROLE_SUPER_ADMIN: ROLE_ADMIN
providers:
chain_provider:
chain:
providers: [fos_userbundle, my_fos_facebook_provider]
fos_userbundle:
id: fos_user.user_provider.username
my_fos_facebook_provider:
id: my.facebook.user
firewalls:
main:
pattern: ^/
fos_facebook:
app_url: "http://apps.facebook.com/xxxx/"
server_url: "http://symfony/app_dev.php/login"
login_path: /login
check_path: /loginFb
default_target_path: /
provider: my_fos_facebook_provider
form_login:
login_path: /login
check_path: /login_check
provider: fos_userbundle …
Run Code Online (Sandbox Code Playgroud) 有人知道如何定制/更改FosFacebook登录按钮的图像?
{{ facebook_login_button({'autologoutlink': true}) }}
Run Code Online (Sandbox Code Playgroud)
并重定向整页Facebook登录不弹出窗口.
问题:
我们一直在使用FOSUserBundle for Symfony2,一切正常,包括"记住我".
我们最近推出了FOSFacebookBundle.从那以后,"记住我"的"正常"登录被打破了.
例如:
当我们只使用FosUSer如果用户通过登录形式登录,并保持,对于为例5小时没有活动,点击任何链接都继续工作,与logined和标识的用户之后.
当我们激活FosFacebook时,同一个用户也通过登录表单(而不是来自Facebook)登录并保持没有活动的时间.单击任何链接后,他将被重定向到登录表单,再次输入密码后,会再次重定向到目标URL.
如果我们从配置中停用FosFacebook,FosUser的"记住我"将再次正常工作.
题:
FosFacebook打破FosUser"自然"是否正常,请记住我没有使用FB的用户?
如果应该正常工作......任何人都可以看到我们的配置文件中是否有错误?
配置文件:
config.yml
# FOS User
fos_user:
db_driver: %database_method% # other valid values are 'mongodb', 'couchdb'
firewall_name: main
user_class: Common\ODMBundle\Document\User
from_email:
address: %fos_email_address%
sender_name: %fos_sender_name%
profile:
form:
type: fos_user_profile
handler: fos_user.profile.form.handler.default
name: fos_user_profile_form
validation_groups: [Profile]
change_password:
form:
type: fos_user_change_password
handler: fos_user.change_password.form.handler.default
name: fos_user_change_password_form
validation_groups: [ChangePassword]
registration:
confirmation:
enabled: true
template: FOSUserBundle:Registration:email.txt.twig
form:
type: fos_user_registration
handler: fos_user.registration.form.handler.default
name: fos_user_registration_form
validation_groups: [Registration]
resetting:
token_ttl: 600
email:
template: FOSUserBundle:Resetting:email.txt.twig
form:
type: fos_user_resetting …
Run Code Online (Sandbox Code Playgroud)