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 8824023
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T06:30:16+00:00 2026-06-14T06:30:16+00:00

I am new to Symfony 2 and never used any framework before. I created

  • 0

I am new to Symfony 2 and never used any framework before.

I created 2 bundles, one for core site which url is as root / it is DefaultBundle then I created a new UserBundle and set all the routing to /user/ the login page is /user/login and it is working fine.

So far I am able to login the user and every thing seems working.

Question really is, how can I check in DefaultBundle that a user is logged in, so I show them Welcome User instead of login/register links on top right side of the front end website.

p.s. I dont need FOSuserBundle as answer,

below is from my security.yml file

jms_security_extra:
    secure_all_services: false
    expressions: true

security:
    encoders:
       Aala\Vital\UserBundle\Entity\User: 
          algorithm: plaintext
#              encode_as_base64: false
#              iterations: 1

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

providers:
    user_area:
      entity: {class: AalaVitalUserBundle:User, property: email}

firewalls:

    login:
        pattern:  ^/user/login$
        security: false
        anonymous: true

    user_area:
        pattern:    ^/user
        form_login:
            login_path: /user/login
            check_path: /user/login_check
            post_only: true
            default_target_path: /user/
        logout:
            path:   /user/logout
            target: /user/

    main:
        pattern: ^/
        security: true
        anonymous: ~


access_control:
    - { path: /.*, role: IS_AUTHENTICATED_ANONYMOUSLY }
    - { path: ^/user, roles: ROLE_USER }

My Folder Structure is as follows

-src
    -Aala
        -Vital
            -FronendBundle
            -UserBundle

Edit:

Is this can be done with dependency injection? if yes how to do that…

  • 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-14T06:30:17+00:00Added an answer on June 14, 2026 at 6:30 am

    Solved

    To share the authentication between two firewalls use context. Below is the updated firewalls section from my security.yml file

    firewalls:
    
        login:
            pattern:  ^/user/login$
            security: false
            anonymous: true
    
        user_area:
            pattern:    ^/user
            context: primary_auth
            form_login:
                login_path: /user/login
                check_path: /user/login_check
                post_only: true
                default_target_path: /user/
            logout:
                path:   /user/logout
                target: /user/
    
        main:
            pattern: ^/
            context: primary_auth
            security: true
            anonymous: ~
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am new to Symfony. I created a layout page in which I have
I am new to symfony. I have created a registration form using the code:
I'm pretty new to the Symfony Framework and currently searching for the Best-Practice way
i am trying to setup a new symfony framework project on ubuntu by following
I'm new to version 2 of the Symfony framework. I made some projects with
I am new to symfony framework. I am trying to populate the city_id form-field
I'm using Symfony 2.0.9 to build a new web site. Yesterday the newer version
I am new to symfony,I want to create a application using Symfony framework using
I know symfony2 and never used symfony1.4. I am going to new company but
I am new to Symfony framework. I got Symfony (v1.4.8) on my Netbeans 6.8

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.