Enable Basic authentication

Enable Basic authentication for your Quarkus project and allow users to authenticate with a username and password.


  • You have installed at least one extension that provides an IdentityProvider based on username and password, such as Elytron JDBC.


  1. Enable Basic authentication by setting the value of quarkus.http.auth.basic property to true.


An easy way to configure the required user credentials for Basic authentication to work is to configure the user name, secret, and roles directly in the application.properties file.

Example of Basic authentication properties

In this configuration the credentials for users alice and bob are configured: alice has a password alice and an admin role, bob has a password bob and a user role.

For more information, see Configuring User Information in the "Security Testing" guide.

Configuring user names, secrets, and roles in the application.properties file is only suitable for testing scenarios. If you are securing an application for production, always use a database to store this information.

To walk through how to configure Basic authentication together with Jakarta Persistence for storing user credentials in a database, see the Secure a Quarkus application with Basic authentication tutorial.