Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Call to a member function validateCredentials() on a non-object in /webapps/symfony-test/vendor/bundles/BeSimple/SsoAuthBundle/Security/Core/Authentication/Token/SsoToken.php on line 39 #16

Closed
david42 opened this issue Mar 12, 2012 · 5 comments

Comments

@david42
Copy link

david42 commented Mar 12, 2012

Hi,

I installed this bundle.

My security.yml :
security:

factories:
    - "%kernel.root_dir%/../vendor/bundles/BeSimple/SsoAuthBundle/Resources/config/security_factories.xml"
encoders:
    Symfony\Component\Security\Core\User\User: plaintext
    dav2\TestBundle\Entity\User: plaintext

  role_hierarchy:
    ROLE_ADMIN:       ROLE_USER
    ROLE_SUPER_ADMIN: [ROLE_USER, ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH]

  providers:
    #in_memory:
    #    users:
    #        user:  { password: userpass, roles: [ 'ROLE_USER' ] }
    #        admin: { password: adminpass, roles: [ 'ROLE_ADMIN' ] }

    user_db:
        entity: { class: dav2\TestBundle\Entity\User, property: username }

  firewalls:
    dev:
        pattern:  ^/(_(profiler|wdt)|css|images|js)/
        security: false



    my_firewall:
        pattern: ^/
        trusted_sso:
            manager: my_manager
            login_action: false
            logout_action: false

access_control:
    - { path: ^/crud, roles: ROLE_ADMIN }

I have this error with URL ^/crud (access_control), the other URL are ok.
If I use the provider "in-memory" and not "user_db", I don't have this problem.

Thanks for your help.

@david42
Copy link
Author

david42 commented Mar 12, 2012

I resolved my problem.

In my entity user, my method :
public function equals(UserInterface $user)
{
}
was empty, I add :
public function equals(UserInterface $user)
{
return $this->getUsername() == $user->getUsername();
}

Now it's ok.

@jfsimon
Copy link
Member

jfsimon commented Mar 14, 2012

Great!

@jfsimon jfsimon closed this as completed Mar 14, 2012
@david42
Copy link
Author

david42 commented Dec 11, 2012

Hello,

I use now symfony 2.1.x
And I have yet this problem.
I saw the documentation, and with symfony 2.1 the equals method has been renamed in " isEqualTo" and it's implemented by EquatableInterface.
It is obliged to implements this method in the user entity?

I tried with:

public function isEqualTo(UserInterface $user)
{
     return $this->getUsername() == $user->getUsername();
}

but I have the same error, $this->getUsername() is null.

Thanks for your help

@david42
Copy link
Author

david42 commented Dec 11, 2012

Re,

It works.
I added the methods serialize and unserialize but I had only the id so I added the username.

@bkosborne
Copy link

I don't think the "solutions" provided here are not a valid resolution to this exception. I detail more about the problem in #73

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants