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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T04:14:24+00:00 2026-06-07T04:14:24+00:00

Is it possible to authenticate via username or IP in Symfony2? I know that

  • 0

Is it possible to authenticate via username or IP in Symfony2?
I know that it’s possible to login with username and password or by IP address, but is it also possible to authenticate when I come from a specfic IP address automatically and if not then via username and password?

Example:

If I come from 10.1.1.1 I want to get the ADMIN_ROLE

If I come from a different IP I have to login via username and password

Here comes my security.yml

        secured_area:
        pattern:    ^/
        anonymous: ~
        form_login:
            check_path: /login_check
            login_path: /login
        logout:
            path:   /logout
            target: /login
        #anonymous: ~
        #http_basic:
        #    realm: "Secured Demo Area"

access_control:
    - { path: ^/login, roles: IS_AUTHENTICATED_ANONYMOUSLY }
    - { path: ^/, roles: ROLE_ADMIN  }
    - { path: ^/, roles: IS_AUTHENTICATED_ANONYMOUSLY, ip: 10.1.1.1 }

Thanks for help!

  • 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-07T04:14:25+00:00Added an answer on June 7, 2026 at 4:14 am

    It is possible but not secure. You can do chained authentication providers (firewall section in the security.yml)

    In your case you will need to implement a custom one for the IP authentication method. You can find a documentation writing a custom authentication provider in the Symfony cookbook( want: http://symfony.com/doc/current/cookbook/security/custom_authentication_provider.html)

    You will have to chain your custom provider and the Symfony2 form auth provider.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am running Socket.IO and have the server part confirming username and password via
Here is the situation: User logs in via username/password stored in an MSSQL database
Is it possible to authenticate from a web page without any server-side program? I
We currently have a .NET 2.0 web app that uses forms authentication via cookies.
I am using jboss-as-7.1.0.Final-SNAPSHOT and trying to set up custom login module that uses
Is it possible to provide Basic authentication to clients using ASP.Net to authenticate the
I'm using Omniauth with Devise to authenticate users via Facebook for a web app
Possible Duplicate: "CSRF token missing or incorrect" while post parameter via AJAX in Django
I am writing a WPF application that I need to authenticate with our current
I'm building a Webapp that uses OpenId to authenticate users, like Stackoverlfow does. There

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.