Closed mattsnowboard closed 10 years ago
And I figured it out...needed a chain_provider
security:
encoders:
FOS\UserBundle\Model\UserInterface: sha512
Kayue\WordpressBundle\Entity\User:
id: kayue_wordpress.security.encoder.phpass
role_hierarchy:
ROLE_LIMITED_ADMIN: ROLE_USER
ROLE_ADMIN_RO: [ROLE_LIMITED_ADMIN]
ROLE_ADMIN: [ROLE_ADMIN_RO]
ROLE_SUPER_ADMIN: [ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH]
access_decision_manager:
strategy: unanimous
providers:
fos_userbundle:
id: fos_user.user_provider.username_email
wordpress:
entity:
class: Kayue\WordpressBundle\Entity\User
property: username
manager_name: wordpress
fos_wp_chain:
chain:
providers: [ fos_userbundle, wordpress ]
firewalls:
main:
pattern: ^/
provider: fos_wp_chain
form_login:
provider: fos_wp_chain
csrf_provider: form.csrf_provider
logout: true
anonymous: true
switch_user: true
kayue_wordpress: ~
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false
access_control:
- { path: ^/login$, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/register, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/admin/, role: ROLE_ADMIN_RO }
- { path: ^/dash/, role: ROLE_USER }
- { path: ^/apply/, role: ROLE_USER }
- { path: ^/profile, role: ROLE_NEW_USER }
Great :+1:
How do I use both this and FOSUserBundle for login?
I want to allow admins on my WP site to login to Symfony, but I'm using FOSUserBundle for normal users.
Do I need separate login forms or can I have one form that tries FOSUserBundle and falls back to Wordpress with KayueWordpressBundle?
So far I have this (but only FOSUserBundle works):