Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8867245
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T16:59:07+00:00 2026-06-14T16:59:07+00:00

Symfony 2.1.3-dev SonataUserBundle SonataAdminBundle JMSI18nRoutingBundle By default the language is french, but I enabled

  • 0
  • Symfony 2.1.3-dev
  • SonataUserBundle
  • SonataAdminBundle
  • JMSI18nRoutingBundle

By default the language is french, but I enabled “en”

I installed this bundles and most things work fine.

But I would like to do the following :

  • A user XXX (SonataUserBundle) has in the field “locale” the value “en”
  • When this user logs in I want to show up the pages in english.
  • The user has not to switch manually.

I think this should be done on the autentification process.

The problem is that SonataUserBundle (based on FOSUser) does not do the authentification (seen HERE)

So I tried to do THIS, but there must be some configuration issues.

When applying the wsse_secured to the whole site :

wsse_secured:
    pattern:   ^/
    wsse:      true

I get the following error : A Token was not found in the SecurityContext.

When adding anonymous to my config.yml :

firewalls:
    ....
    main:
        pattern: ^/
        wsse:      true
        anonymous:       true

I can access the home page, but when trying to login I get this error :
You must configure the check path to be handled by the firewall using form_login in your security firewall configuration.

When adding the checkpath for FOS it works but the systems does not work with my wsse-provider (I added code in WsseProvider.php to make me know)

So my question : How can I get work this WSSE authentification. I followed strictly the indications in the doc.

EDIT :

I perhaps made an error by implementing the wsse security files in my own bundle.
Now I moved it to sonata user bundle and I get the following error :

ErrorException: Catchable Fatal Error: Argument 1 passed to Application\Sonata\UserBundle\Security\Authentication\Provider\WsseProvider::__construct() must implement interface Symfony\Component\Security\Core\User\UserProviderInterface, string given, called in ..\app\cache\dev\appDevDebugProjectContainer.php on line 4413 and defined in ..\src\Application\Sonata\UserBundle\Security\Authentication\Provider\WsseProvider.php line 17

What’s wrong with my UserProviderInterface in WsseProvider.php :

<?php

namespace Application\Sonata\UserBundle\Security\Authentication\Provider;

use Symfony\Component\Security\Core\Authentication\Provider\AuthenticationProviderInterface;
use Symfony\Component\Security\Core\User\UserProviderInterface;
use Symfony\Component\Security\Core\Exception\AuthenticationException;
use Symfony\Component\Security\Core\Exception\NonceExpiredException;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
use Application\Sonata\UserBundle\Security\Authentication\Token\WsseUserToken;

class WsseProvider implements AuthenticationProviderInterface
{
    private $userProvider;
    private $cacheDir;

    public function __construct(UserProviderInterface $userProvider, $cacheDir)
    {
        $this->userProvider = $userProvider;
        $this->cacheDir     = $cacheDir;
    }
...
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T16:59:08+00:00Added an answer on June 14, 2026 at 4:59 pm

    I’ve solve this problem with a simple KernelRequestListener:

    <?php
    namespace ACME\DemoBundle\Listener;
    
    use Symfony\Component\HttpKernel\Event\GetResponseEvent;
    use Symfony\Component\DependencyInjection\ContainerInterface;
    
    
    class RequestListener
    {
    protected $container;
    
    public function __construct(ContainerInterface $container)
    {
        $this->container = $container;
    }
    
    public function onKernelRequest(GetResponseEvent $event)
    {
        $userlocale = null;
        $request = $event->getRequest();
        $user = $this->container->get('security.context')->getToken()->getUser();
    
        if (!is_object($user)) {
            return;
        }
    
        $userlocale = $user->getLocale();
        if($userlocale !== NULL AND $userlocale !== '')
        {
            $request->setLocale($userlocale);
        }
    }
    }
    

    Register service in Acme/Demo/Resources/service.yml:

    ACME.demo.listener.request:
          class: ACME\DemoBundle\Listener\RequestListener
          arguments: [ @service_container ]
          tags:
            - { name: kernel.event_listener, event: kernel.request, method: onKernelRequest }
    

    Other solution I’ve found there: Here

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just installed Symfony 2 on my remote host. But when I run web/app_dev.php
I'm using propel master-dev with symfony 2.1. Is possible to write something like that
I'm using Symfony 2.1-dev and am having problems when authenticate users using a form.
I've set up Symfony authentication on my local dev server, it works perfectly in
In Symfony how to set default values to sfWidgetFormDateRange from action
I installed xampp and it works great with my symfony. I even made few
I found the console and run it like this: root@valugi-laptop:/var/www/sandbox/hello# php console Symfony version
I am new to symfony and maybe I am missing something really simple but
Using Symfony 2.1.3-dev and Doctrine 2.3 I am attempting to build a form which
I have a symfony-project (2.0.0-DEV = RC5) which i want to upgrade to the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.