0

I want to configure my security.yml in my project to require HTTP Basic authentication from all hosts excluding localhost? Is it possible? I have failed to find a solution on the Web.

2
  • did you try the regexp negation in the security pattern? Commented Oct 30, 2012 at 13:41
  • 1
    Can you can give me any example of that solution? Commented Oct 30, 2012 at 17:44

1 Answer 1

1

You could create a request matcher.

You can follow this great tutorial to enable the request matcher http://php-and-symfony.matthiasnoback.nl/2012/07/symfony2-security-using-advanced-request-matchers-to-activate-firewalls/

Only follow the "Creating an advanced request matcher" and "Hook the request matcher in the security configuration" sections though.

Your match method would look like this:

return 'localhost' == $request->getHost();
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.