Questions tagged [symfony-security]

The Symfony security component is a standalone library that can be used outside of Symfony2 projects.

Symfony security component provides a complete security system for your web application. It ships with facilities for authenticating using HTTP basic or digest authentication, interactive form login or X.509 certificate login, but also allows you to implement your own authentication strategies. Furthermore, the component provides ways to authorize authenticated users based on their roles, and it contains an advanced ACL system.

Useful links

276 questions
0
votes
2 answers

How to programmatically login a user in Symfony with its login and password?

I want to write a functional test like this: $user = $auth->login($username, $password); Then I can check behaviors like: the login fails if the username/password doesn't match a user the login fails if the user is disabled the login works…
Matthieu Napoli
  • 48,448
  • 45
  • 173
  • 261
0
votes
2 answers

Symfony 4 : How to have multi providers for user/admin in firewall?

I can not have two different providers for user and admin with two different forms I want to have two firewalls, for users and for admins. I created two different providers linking two different entities. I can log in as a user, but never as Admin…
Fabrice
  • 47
  • 10
0
votes
1 answer

Regex : Everything but not [string]

I work under symfony, and I would like to configure my pattern in security so that it applies to everything but a certain path. (/Home) I made that but it doesn't work and I don't know Regex : pattern: ^/(?!/accueil).*$ There I am obliged to put…
eronn
  • 1,690
  • 3
  • 21
  • 53
0
votes
1 answer

Symfony guard throws AuthenticationException but user loaded successfully

I want to implement form login with Symfony/Security to my app. I configured everything but it still doesn't work properly. This is my security.yaml: security: providers: sablon_users: entity: class:…
0
votes
1 answer

How to properly add a user after using makerbundle make:auth

I'm setting up login authentication for a Symfony 4 app using MakerBundle 1.8's feature listed below: php bin/console make:auth This feature is described in this article:…
Erich
  • 499
  • 1
  • 13
  • 34
0
votes
1 answer

Symfony 4 dynamic database connection & FOS User

Using Symfony 4, we are building a multi-customer application where each customer has a dedicated database. Customer databases are created automatically on-demand when new Customer is created. During this process, we create unique extra .env file…
werd
  • 648
  • 4
  • 13
  • 23
0
votes
0 answers

Symfony: Storing user roles where can be created and changed by a more privilidged user

According to this piece of symfony's documentation tells you how to store and load a user from the database. But I have an question, let suppose there is a user with role ROLE_ADMIN and has the ability to create new application roles, for example…
Dimitrios Desyllas
  • 9,082
  • 15
  • 74
  • 164
0
votes
1 answer

Symfony 403 thrown with correct role

Weird issue here. I have a 403 error when I try to access a endpoint of my API whereas the users's role is correct. Here's my route's annotation (I'm using FosRestBundle) /** * @Rest\Get("home/{id}/versions", requirements={"id"="\d+"}) *…
loicb
  • 587
  • 2
  • 6
  • 24
0
votes
1 answer

How to handle an Ajax call on pages that requires authentication and / or authorization?

If a page needs authentication and no User is found Symfony simply redirects or shows the login page. So simple enough I got that working. Next, I would like to send a custom message (or html) if the User makes an Ajax call inside a page that…
StefanNch
  • 2,569
  • 24
  • 31
0
votes
1 answer

Can I mark a single URI endpoint as anonymous?

I have read the docs and followed this similar question: Allow anonymous access to specific URL in symfony firewall protected bundle Using Symfony 4.1.4 I have tried the following: access_control: - { path: ^/rpi/service/application/quote/approve,…
Alex.Barylski
  • 2,843
  • 4
  • 45
  • 68
0
votes
0 answers

Symfony Security and FOSUserBundle: trouble with ROLE_ADMIN permission

I want to show a certain div if the user has ROLE_ADMIN attributed to him. In the database, the user has the roles ROLE_ADMIN and ROLE_USER: a:1:{i:0;s:10:"ROLE_ADMIN";} However, when I use the following code, the user is not granted permission and…
Helenesh
  • 3,999
  • 2
  • 21
  • 36
0
votes
1 answer

Symfony4 security issue

I try to create a simple login form with users created or registered thru the webapp. This is my security.yml file security: firewalls: dev: pattern: ^/(_(profiler|wdt)|css|images|js)/ security: false …
Mookum
  • 33
  • 7
0
votes
0 answers

Looking for a can_access_route method

The security of my Symfony 4 application is using @security annotations in controllers : /** * @Route("/cat/list", name="cat_list") * * @Security("is_granted('ROLE_XYZ'") */ public function listAction() { // [...] } I am building a menu…
Wink
  • 43
  • 6
0
votes
1 answer

Is it possible to inject the current firewall's user provider service into a custom service?

I'm facing a good challenge in one of my projects. I need to inject the User Provider defined for a firewall in a service of a third party bundle that I'm developing. I cannot define it explicitly in my service, because I want to achieve that, when…
0
votes
0 answers

Impossible connexion to admin panel with Symfony 4 / Security

I'm pretty new to Symfony 4 and it is mostly the first time I ever use something to handle connexion to an admin panel, or either yaml file to set parameters. As recommended in the documentation, I'm using Security recipe. As the whole site was…
Zyigh
  • 425
  • 4
  • 16