이 콘텐츠는 선택한 언어로 제공되지 않습니다.
Chapter 2. Enable Basic authentication
Enable Basic authentication for your Quarkus project and allow users to authenticate with a username and password.
2.1. Prerequisites 링크 복사링크가 클립보드에 복사되었습니다!
You have installed at least one extension that provides an
IdentityProvider
based on username and password. For example:
The following procedure outlines how you can enable Basic authentication for your application by using the elytron-security-properties-file
extension.
2.2. Procedure 링크 복사링크가 클립보드에 복사되었습니다!
In the
application.properties
file, set thequarkus.http.auth.basic
property totrue
.quarkus.http.auth.basic=true
quarkus.http.auth.basic=true
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Optional: In a non-production environment only and purely for testing Quarkus Security in your applications:
To enable authentication for the embedded realm, set the
quarkus.security.users.embedded.enabled
property totrue
.quarkus.security.users.embedded.enabled=true
quarkus.security.users.embedded.enabled=true
Copy to Clipboard Copied! Toggle word wrap Toggle overflow You can also configure the required user credentials, user name, secret, and roles. For example:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow For information about other methods that you can use to configure the required user credentials, see the Configuring User Information section of the Quarkus "Security Testing" guide.
ImportantConfiguring user names, secrets, and roles in the
application.properties
file is appropriate only for testing scenarios. For securing a production application, it is crucial to use a database to store this information.
2.3. Next steps 링크 복사링크가 클립보드에 복사되었습니다!
For a more detailed walk-through that shows you how to configure Basic authentication together with Jakarta Persistence for storing user credentials in a database, see the Getting started with Security by using Basic authentication and Jakarta Persistence guide.