Development security¶
Tip
See Permissions for information about the permissions system in Ibexa DXP.
Security checklist
See the Security checklist for a list of security-related issues you should take care of before going live with a project.
Symfony authentication¶
To use Symfony authentication with Ibexa DXP, use the following configuration (in config/packages/security.yaml):
1 2 3 4 5 6 7 8 9 | |
And in config/routes.yaml:
1 2 3 4 5 6 7 | |
Note
You can fully customize the routes and/or the controller used for login.
However, remember to match login_path, check_path and logout.path from security.yaml.
See security configuration reference and standard login form documentation.
Authentication using Symfony Security component¶
Authentication is provided by the Symfony Security component.
Native and universal form_login is used, in conjunction with an extended DaoAuthenticationProvider (DAO stands for Data Access Object), the RepositoryAuthenticationProvider.
Native behavior of DaoAuthenticationProvider has been preserved, making it possible to still use it for pure Symfony applications.
Security controller¶
A SecurityController is used to manage all security-related actions and is thus used to display the login form.
It follows all standards explained in Symfony security documentation.
The base template used is Security/login.html.twig.
The layout used by default is %ibexa.content_view.viewbase_layout% (empty layout) but can be configured together with the login template:
1 2 3 4 5 6 | |
Redirection after login¶
By default, Symfony redirects to the URI configured in security.yaml as default_target_path. If not set, it defaults to /.
Remember me¶
It's possible to use the "Remember me" functionality. Refer to the Symfony cookbook on this topic.
If you want to use this feature, you must at least extend the login template to add the required checkbox:
1 2 3 4 5 6 7 | |
Login handlers / SSO¶
Symfony provides native support for multiple user providers. This makes it easy to integrate any kind of login handlers, including SSO and existing third-party bundles (for example, FR3DLdapBundle, HWIOauthBundle, FOSUserBundle, BeSimpleSsoAuthBundle, and more).
See Authenticating a user with multiple user provider for more information.
JWT authentication¶
To use JWT authentication with Ibexa DXP, in the provided config/packages/lexik_jwt_authentication.yaml file, modify the existing configuration by setting authorization_header to enabled:
1 2 3 4 5 6 7 8 9 10 11 12 | |
You also need to configure Symfony firewalls for the APIs with which you want to use JWT authentication.
It's already provided in config/packages/security.yaml, you need to uncomment the ibexa_jwt_rest and the ones for the desired APIs:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | |
ibexa_jwt_restis the firewall allowing to generate a JWT token through REST or GraphQLibexa_jwt_rest.apiis the firewall to use JWT authentication for REST API instead of session-basedibexa_jwt_mcpis the firewall to use JWT authentication for MCP serversibexa_jwt_graphqlis the firewall to use JWT authentication for GraphQL API
For example, to use JWT authentication only for MCP servers and keep session-based authentication for REST and GraphQL:
- uncomment
ibexa_jwt_restandibexa_jwt_mcpto activate them - keep
ibexa_jwt_rest.apiandibexa_jwt_graphqlcommented and disabled
Use PEM keys¶
Out of the box, JWT tokens are created using Hash-based Message Authentication Code (HMAC) with APP_SECRET as the secret key and the HMAC-SHA256 (HS256) algorithm.
You can use Privacy-enhanced Electronic Mail (PEM) keys and the RSA-SHA256 (RS256) algorithm instead.
- Set
JWT_PASSPHRASEsecret
In a .env file, you should have the following variables:
1 2 3 | |
Set your JWT_PASSPHRASE, its value needs to be a strong, random, and securely stored value.
For more recommendations and how to generate one, see APP_SECRET and other secret.
- In
config/packages/lexik_jwt_authentication.yaml, use the following configuration:
1 2 3 4 5 6 7 | |
- Generate a PEM encoded key pair in
config/jwtdirectory by using the command:
1 | |
Ibexa Cloud
To store the tokens on Ibexa Cloud, define the config/jwt directory as a volume in the .platform.app.yaml file.
In 3-node cluster setups, ensure that the key pair is the same on all 3 servers.
You can use a network share, or use a local mount and manually copy the key pair between the servers.
For more information, see LexikJWTAuthenticationBundle configuration reference.