Note that there are some explanatory texts on larger screens.

plurals
  1. POBypassing authentication on Symfony2 "welcome" page
    primarykey
    data
    text
    <p>The way I'm handling authentication on my app is to put 100% of everything behind authentication, then to specify certain exceptions.</p> <p>These exceptions include the login page and a few other pages. Everything is working fine except one part: the "default" page, or whatever you want to call it. I don't want people to have to log in in order to see the front page of my site, obviously, but I don't know how to make authentication not required for that.</p> <p>Here's my route for my welcome page:</p> <pre><code>_welcome: pattern: / defaults: { _controller: VNNPressboxBundle:User:welcome } </code></pre> <p>Here's my <code>app/config/security.yml</code>:</p> <pre><code>security: encoders: Symfony\Component\Security\Core\User\User: algorithm: sha1 iterations: 1 encode_as_base64: false VNN\PressboxBundle\Entity\User: algorithm: sha1 iterations: 1 encode_as_base64: false role_hierarchy: ROLE_ADMIN: ROLE_USER ROLE_SUPER_ADMIN: [ROLE_USER, ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH] providers: administrators: entity: { class: VNNPressboxBundle:User, property: username } firewalls: dev: pattern: ^/(_(profiler|wdt)|css|images|js)/ security: false secured_area: pattern: ^/ form_login: ~ logout: ~ anonymous: ~ http_basic: realm: "Secured Demo Area" access_control: - { path: ^/_welcome, roles: IS_AUTHENTICATED_ANONYMOUSLY } - { path: ^/login, roles: IS_AUTHENTICATED_ANONYMOUSLY } - { path: ^/user/new, roles: IS_AUTHENTICATED_ANONYMOUSLY } - { path: ^/user/create, roles: IS_AUTHENTICATED_ANONYMOUSLY } - { path: ^/user/thanks, roles: IS_AUTHENTICATED_ANONYMOUSLY } - { path: ^/user/agreement, roles: IS_AUTHENTICATED_ANONYMOUSLY } - { path: ^/user/welcome, roles: IS_AUTHENTICATED_ANONYMOUSLY } - { path: ^/user/activate, roles: IS_AUTHENTICATED_ANONYMOUSLY } - { path: ^/signup, roles: IS_AUTHENTICATED_ANONYMOUSLY } - { path: ^/admin, roles: ROLE_ADMIN } - { path: ^/, roles: ROLE_USER } </code></pre> <p>The relevant part, of course, is this:</p> <pre><code>access_control: - { path: ^/_welcome, roles: IS_AUTHENTICATED_ANONYMOUSLY } </code></pre> <p>Even though I have things set that way, I always get booted to the login screen when I try to go to my welcome page (and by that I mean <code>http://myapp.com/app_dev.php</code> as opposed to <code>http://myapp.com/app_dev.php/user/welcome</code>). What am I missing?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload