Repository: quarkusio/quarkus
Issue: BasicAuthenticationMechanism challenge contains a `Quarkus` realm property

### Describe the bug

It adds `realm="Quarkus"` to the `WWW-Authenticate` header - it is an implementation detail (that `Quarkus` is used) and also adding `realm` causes side-effects for some applications.



### Expected behavior

`realm` property should be returned only if it is configured

### Actual behavior

_No response_

### How to Reproduce?

_No response_

### Output of `uname -a` or `ver`

_No response_

### Output of `java -version`

_No response_

### GraalVM version (if different from Java)

_No response_

### Quarkus version or git rev

_No response_

### Build tool (ie. output of `mvnw --version` or `gradlew --version`)

_No response_

### Additional information

_No response_

Changed files:
integration-tests/oidc/src/test/java/io/quarkus/it/keycloak/BearerTokenAuthorizationTest.java
extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/security/HttpSecurityRecorder.java
extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/security/BasicAuthenticationMechanism.java
extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/AuthConfig.java
extensions/vertx-http/deployment/src/test/java/io/quarkus/vertx/http/security/CombinedFormBasicAuthTestCase.java

diff --git a/extensions/vertx-http/deployment/src/test/java/io/quarkus/vertx/http/security/CombinedFormBasicAuthTestCase.java b/extensions/vertx-http/deployment/src/test/java/io/quarkus/vertx/http/security/CombinedFormBasicAuthTestCase.java
index f1ff0f674b6..ea98c661856 100644
--- a/extensions/vertx-http/deployment/src/test/java/io/quarkus/vertx/http/security/CombinedFormBasicAuthTestCase.java
+++ b/extensions/vertx-http/deployment/src/test/java/io/quarkus/vertx/http/security/CombinedFormBasicAuthTestCase.java
@@ -23,6 +23,7 @@ public class CombinedFormBasicAuthTestCase {
 
     private static final String APP_PROPS = "" +
             "quarkus.http.auth.basic=true\\n" +
+            "quarkus.http.auth.realm=TestRealm\\n" +
             "quarkus.http.auth.form.enabled=true\\n" +
             "quarkus.http.auth.form.login-page=login\\n" +
             "quarkus.http.auth.form.error-page=error\\n" +
@@ -154,7 +155,7 @@ public void testBasicAuthFailure() {
                 .then()
                 .assertThat()
                 .statusCode(401)
-                .header("WWW-Authenticate", equalTo("basic realm=\\"Quarkus\\""));
+                .header("WWW-Authenticate", equalTo("basic realm=\\"TestRealm\\""));
 
     }
 }
diff --git a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/AuthConfig.java b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/AuthConfig.java
index c2bfb0bb43a..3e609d66f98 100644
--- a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/AuthConfig.java
+++ b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/AuthConfig.java
@@ -29,8 +29,8 @@ public class AuthConfig {
     /**
      * The authentication realm
      */
-    @ConfigItem(defaultValue = "Quarkus")
-    public String realm;
+    @ConfigItem
+    public Optional<String> realm;
 
     /**
      * The HTTP permissions
diff --git a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/security/BasicAuthenticationMechanism.java b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/security/BasicAuthenticationMechanism.java
index 1abbb36a500..60566daba95 100644
--- a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/security/BasicAuthenticationMechanism.java
+++ b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/security/BasicAuthenticationMechanism.java
@@ -95,7 +95,7 @@ public BasicAuthenticationMechanism(final String realmName, final boolean silent
 
     public BasicAuthenticationMechanism(final String realmName, final boolean silent,
             Charset charset, Map<Pattern, Charset> userAgentCharsets) {
-        this.challenge = BASIC_PREFIX + "realm=\\"" + realmName + "\\"";
+        this.challenge = realmName == null ? BASIC : BASIC_PREFIX + "realm=\\"" + realmName + "\\"";
         this.silent = silent;
         this.charset = charset;
         this.userAgentCharsets = Collections.unmodifiableMap(new LinkedHashMap<>(userAgentCharsets));
diff --git a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/security/HttpSecurityRecorder.java b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/security/HttpSecurityRecorder.java
index 9a17a290d64..48a55cba4d3 100644
--- a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/security/HttpSecurityRecorder.java
+++ b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/security/HttpSecurityRecorder.java
@@ -279,7 +279,8 @@ public Supplier<?> setupBasicAuth(HttpBuildTimeConfig buildTimeConfig) {
         return new Supplier<BasicAuthenticationMechanism>() {
             @Override
             public BasicAuthenticationMechanism get() {
-                return new BasicAuthenticationMechanism(buildTimeConfig.auth.realm, buildTimeConfig.auth.form.enabled);
+                return new BasicAuthenticationMechanism(buildTimeConfig.auth.realm.orElse(null),
+                        buildTimeConfig.auth.form.enabled);
             }
         };
     }
diff --git a/integration-tests/oidc/src/test/java/io/quarkus/it/keycloak/BearerTokenAuthorizationTest.java b/integration-tests/oidc/src/test/java/io/quarkus/it/keycloak/BearerTokenAuthorizationTest.java
index 993d3b9ac2b..7e98044f368 100644
--- a/integration-tests/oidc/src/test/java/io/quarkus/it/keycloak/BearerTokenAuthorizationTest.java
+++ b/integration-tests/oidc/src/test/java/io/quarkus/it/keycloak/BearerTokenAuthorizationTest.java
@@ -75,7 +75,7 @@ public void testBasicAuthWrongPassword() {
                 .when().get("/api/users/me")
                 .then()
                 .statusCode(401)
-                .header("WWW-Authenticate", equalTo("basic realm=\\"Quarkus\\""));
+                .header("WWW-Authenticate", equalTo("basic"));
     }
 
     @Test
@@ -144,7 +144,7 @@ public void testVerificationFailedNoBearerTokenAndBasicCreds() {
         RestAssured.given()
                 .when().get("/api/users/me").then()
                 .statusCode(401)
-                .header("WWW-Authenticate", equalTo("basic realm=\\"Quarkus\\""));
+                .header("WWW-Authenticate", equalTo("basic"));
     }
 
     @Test
@@ -171,7 +171,7 @@ public void testBearerAuthFailureWhereBasicIsRequired() {
                 .when().get("/basic-only")
                 .then()
                 .statusCode(401)
-                .header("WWW-Authenticate", equalTo("basic realm=\\"Quarkus\\""));
+                .header("WWW-Authenticate", equalTo("basic"));
     }
 
     @Test