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

  • SEARCH
  • Home
  • 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 9097099
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T00:01:25+00:00 2026-06-17T00:01:25+00:00

So I am trying to create a new Silex application and use the Security

  • 0

So I am trying to create a new Silex application and use the Security bundle included. For simplicities sake I was going to go with the basic password encoding.

Per the Silex documentation http://silex.sensiolabs.org/doc/providers/security.html I have created a custom User Provider. However this user interface does not seem to use the default password encoding.

I can successfully get a password out of

$password = $app['security.encoder.digest']->encodePassword('foo');

However when I use the example

// find the encoder for a UserInterface instance
$encoder = $app['security.encoder_factory']->getEncoder($user);

// compute the encoded password for foo
$password = $encoder->encodePassword('foo', $user->getSalt());

I get the

RuntimeException: No encoder has been configured for account

In symfony2, I would use something like the following

encoders:
        somename:
            class: Acme\DemoBundle\Entity\User
        Acme\DemoBundle\Entity\User: sha512
        Acme\DemoBundle\Entity\User: plaintext
        Acme\DemoBundle\Entity\User:
            algorithm: sha512
            encode_as_base64: true
            iterations: 5000
        Acme\DemoBundle\Entity\User:
            id: my.custom.encoder.service.id

But that doesnt seem to be the case here. I can’t seem to find any type of setEncoder method so I am a bit stumped.

  • 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-17T00:01:26+00:00Added an answer on June 17, 2026 at 12:01 am

    You need to reconstruct the EncoderFactory to add your custom implementation:

    <?php
    
    $app = new Silex\Application();
    $app['myapp.encoder.base64'] = new Base64PasswordEncoder();
    $app['security.encoder_factory'] = $app->share(function ($app) {
        return new EncoderFactory(
            array(
                'Symfony\Component\Security\Core\User\UserInterface' => $app['security.encoder.digest'],
                'MyApp\Model\UserInterface'                          => $app['myapp.encoder.base64'],
            )
        );
    });
    

    (oh and please, don’t use a Base64Encoder() for password ;))

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

Sidebar

Related Questions

I am trying to create a new web application using PowerShell. I keep getting
I am trying to create a new library (.dll) for use in my SSIS
I'm pretty new to Silex and Symfony and I'm trying to create a form
I'm trying to create new aggregate function in PostgreSQL to use instead of the
I'm trying to create new application using BLToolkit but i can't compile the code,
I'm trying to create new user in WebLogic 11g security realm. InitialContext ctx =
In my rails application I am trying to create a new user from a
Im trying to create new file on D: drive with c/c++ I found this
I am now trying to create new database manager under Fragment class. But unfortunately,
I am trying to create new Event objects to be persisted in the database

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.