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

Chain user provider doesn't search in all user providers #1956

Merged
merged 2 commits into from
Aug 23, 2011
Merged

Chain user provider doesn't search in all user providers #1956

merged 2 commits into from
Aug 23, 2011

Conversation

Abhoryo
Copy link

@Abhoryo Abhoryo commented Aug 13, 2011

I commit these changes because Chain user provider doesn't search in all user providers.

Example with the Acme/DemoBundle:

// security.yml
...
    providers:
        chain_provider:
            providers: [in_memory, in_memory_extend]
        in_memory_extend:
            users:
                admin2: { password: adminpass2, roles: [ 'ROLE_ADMIN' ] }
        in_memory:
            users:
                user:  { password: userpass, roles: [ 'ROLE_USER' ] }
...
    firewalls:
...
        secured_area:
            pattern:    ^/demo/secured/
            provider: chain_provider OR in_memory_extend
...

We can see these logs :

security.INFO: User "admin2" has been authenticated successfully [] []
security.DEBUG: Write SecurityContext in the session [] []
security.DEBUG: Read SecurityContext from the session [] []
security.DEBUG: Reloading user from user provider. [] []
security.WARNING: Username "admin2" could not be found. [] []

The new code search in others user providers when a user is not found in the first user provider and throws the right exception.

Abhoryo added 2 commits August 14, 2011 00:00
… user provider and throws the right exception.
@lsmith77
Copy link
Contributor

I wonder if it should be a provider option to continue on a failed user lookup. I can see cases where you really dont want to iterate over all providers and others where you do.

@Abhoryo
Copy link
Author

Abhoryo commented Aug 15, 2011

If someone need a provider like you describe, he can create one.
Here we talk about a chain user provider.

Doc : using-multiple-user-providers

We can read in the doc: "The chain_provider will, in turn, try to load the user from both the in_memory and user_db providers."
But its not the case right now.

@Abhoryo Abhoryo closed this Aug 15, 2011
@Abhoryo Abhoryo reopened this Aug 15, 2011
fabpot added a commit that referenced this pull request Aug 23, 2011
Commits
-------

e9d2a67 CS
3a64b08 Search in others user providers when a user is not found in the first user provider and throws the right exception.

Discussion
----------

Chain user provider doesn't search in all user providers

I commit these changes because Chain user provider doesn't search in all user providers.

Example with the Acme/DemoBundle:

    // security.yml
    ...
        providers:
            chain_provider:
                providers: [in_memory, in_memory_extend]
            in_memory_extend:
                users:
                    admin2: { password: adminpass2, roles: [ 'ROLE_ADMIN' ] }
            in_memory:
                users:
                    user:  { password: userpass, roles: [ 'ROLE_USER' ] }
    ...
        firewalls:
    ...
            secured_area:
                pattern:    ^/demo/secured/
                provider: chain_provider OR in_memory_extend
    ...

We can see these logs :

    security.INFO: User "admin2" has been authenticated successfully [] []
    security.DEBUG: Write SecurityContext in the session [] []
    security.DEBUG: Read SecurityContext from the session [] []
    security.DEBUG: Reloading user from user provider. [] []
    security.WARNING: Username "admin2" could not be found. [] []

The new code search in others user providers when a user is not found in the first user provider and throws the right exception.

---------------------------------------------------------------------------

by lsmith77 at 2011/08/14 12:20:04 -0700

I wonder if it should be a provider option to continue on a failed user lookup. I can see cases where you really dont want to iterate over all providers and others where you do.

---------------------------------------------------------------------------

by Abhoryo at 2011/08/14 17:27:16 -0700

If someone need a provider like you describe, he can create one.
Here we talk about a chain user provider.

Doc : [using-multiple-user-providers](http://symfony.com/doc/current/book/security.html#using-multiple-user-providers)

We can read in the doc: "The chain_provider will, in turn, try to load the user from both the in_memory and user_db providers."
But its not the case right now.
@fabpot fabpot merged commit e9d2a67 into symfony:master Aug 23, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants