Mmm.. digging a little bit on my code I've found that my security.config on
my config_test.yml is not loaded properly. It seems to ignore my overrides
on the security config (although if I put a bad name for a security config
parameter, it throws an error, behaving just like it should).

My config.yml:

# ...

security.config:
    providers:
        default:
            password_encoder: sha1
            entity: { class: Application\FaxServerBundle\Entity\User }
    firewalls:
        js_routes:
            pattern:            /security/url_list
            anonymous:          true
        js_translation:
            pattern:            /translation/get_strings
            anonymous:          true
        dashboard:
            pattern:            /dashboard.*
            anonymous:          true
        reset_password:
            pattern:            /reset_password.*
            anonymous:          true
        private:
            pattern:            /.*
            logout:             { path: /security/logout }
            form_login:
                login_path:         /security/login
                check_path:         /security/login_check
                logout:             true
    access_control:
        - { path: /security/url_list, role: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: /translation/get_strings, role:
IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: /dashboard.*, role: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: /reset_password.*, role: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: /fax/get.*, role: ROLE_WEB_ACCESS }
        - { path: /help.*, role: ROLE_WEB_ACCESS }
        - { path: /user/update.*, role: ROLE_WEB_ACCESS }
        - { path: /security/download.*, role: ROLE_WEB_ACCESS }
        - { path: /.*, role: ROLE_IS_ADMIN }

# ...

And on my config_test.yml:

# ...
security.config:
    providers:
        default:
            users:
                admin:      { password: 1234, roles: [ 'ROLE_IS_ADMIN',
'ROLE_WEB_ACCESS' ] }
                web_access: { password: 1234, roles: ROLE_WEB_ACCESS }
    firewalls:
        main:
            pattern:            /.*
            http_basic:         true
            stateless:          true
# ...


It seems that it ignores the firewalls setting on config_test.yml. It keeps
trying to log the user with a form. I tried to deactivate the security from
config_test with no luck.

Am I missing something here?



BTW: I'm looking at your bundle and it seems to be really useful. I was
looking for a way to test a command too. I'll give it a try at work, thanks!

On Sun, Dec 26, 2010 at 7:23 PM, Lukas Kahwe Smith <[email protected]>wrote:

>
> On 22.12.2010, at 20:37, Gustavo Adrian wrote:
>
> >
> > $client->request( 'POST', 'myURL', array(), array(), array(
> >       'PHP_AUTH_USER'         => 'admin',
> >       'PHP_AUTH_PW'           => '1234'
> > ) );
> >
> > But it doesn't work. Am I missing something else?
>
> hmm that looks pretty good to me. though i usually set the parameters when
> creating the client so that its automatically set in every request. also i
> am authenticating with an entity:
>
> $params = array('PHP_AUTH_USER' => $authentication['username'],
> 'PHP_AUTH_PW' => $authentication['password']);
> $client = $this->createClient(array('environment' => 'test'), $params);
>
> I have created a Bundle with some helpers for functional tests:
> https://github.com/liip/FunctionalTestBundle
>
> It also has an example for how to load fixtures and how to do a test for a
> command.
>
> regards,
> Lukas Kahwe Smith
> [email protected]
>
>
>
> --
> If you want to report a vulnerability issue on symfony, please send it to
> security at symfony-project.com
>
> You received this message because you are subscribed to the Google
> Groups "symfony developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]<symfony-devs%[email protected]>
> For more options, visit this group at
> http://groups.google.com/group/symfony-devs?hl=en
>

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/symfony-devs?hl=en

Reply via email to