Skip to content

Commit 1fe7eaf

Browse files
authored
Merge pull request #46416 from michalvavrik/feature/drop-http-auth-mech-sync-get-creds-transport-method
Drop deprecated synchronous 'getCredentialTransport' declared on HttpAuthenticationMechanism
2 parents 7ae15c3 + 7133be5 commit 1fe7eaf

File tree

2 files changed

+5
-26
lines changed

2 files changed

+5
-26
lines changed

extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/security/HttpAuthenticationMechanism.java

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -41,23 +41,11 @@ default Uni<Boolean> sendChallenge(RoutingContext context) {
4141
/**
4242
* The credential transport, used for finding the best candidate for authenticating and challenging when more than one
4343
* mechanism is installed.
44-
* and finding the best candidate for issuing a challenge when more than one mechanism is installed.
4544
*
46-
* May be null if this mechanism cannot interfere with other mechanisms
47-
*/
48-
@Deprecated(since = "2.8", forRemoval = true)
49-
default HttpCredentialTransport getCredentialTransport() {
50-
throw new UnsupportedOperationException();
51-
}
52-
53-
/**
54-
* The credential transport, used for finding the best candidate for authenticating and challenging when more than one
55-
* mechanism is installed.
56-
*
57-
* May be null if this mechanism cannot interfere with other mechanisms
45+
* May be {@link Uni} with null item if this mechanism cannot interfere with other mechanisms.
5846
*/
5947
default Uni<HttpCredentialTransport> getCredentialTransport(RoutingContext context) {
60-
throw new UnsupportedOperationException();
48+
return Uni.createFrom().nullItem();
6149
}
6250

6351
class ChallengeSender implements Function<ChallengeData, Boolean> {

extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/security/HttpAuthenticator.java

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ public Uni<? extends ChallengeData> apply(ChallengeData data) {
370370

371371
private Uni<SecurityIdentity> authenticateWithAllMechanisms(SecurityIdentity identity, int i,
372372
RoutingContext routingContext) {
373-
return getCredentialTransport(mechanisms[i], routingContext)
373+
return mechanisms[i].getCredentialTransport(routingContext)
374374
.onItem().transformToUni(new Function<HttpCredentialTransport, Uni<? extends SecurityIdentity>>() {
375375
@Override
376376
public Uni<SecurityIdentity> apply(HttpCredentialTransport httpCredentialTransport) {
@@ -425,7 +425,7 @@ public Uni<? extends HttpAuthenticationMechanism> apply(HttpAuthenticationMechan
425425

426426
private Uni<HttpAuthenticationMechanism> getPathSpecificMechanism(int index, RoutingContext routingContext,
427427
String pathSpecificMechanism) {
428-
return getCredentialTransport(mechanisms[index], routingContext).onItem()
428+
return mechanisms[index].getCredentialTransport(routingContext).onItem()
429429
.transform(new Function<HttpCredentialTransport, HttpAuthenticationMechanism>() {
430430
@Override
431431
public HttpAuthenticationMechanism apply(HttpCredentialTransport t) {
@@ -458,15 +458,6 @@ static void selectAuthMechanism(RoutingContext routingContext, String authMechan
458458
routingContext.put(AUTH_MECHANISM, authMechanism);
459459
}
460460

461-
private static Uni<HttpCredentialTransport> getCredentialTransport(HttpAuthenticationMechanism mechanism,
462-
RoutingContext routingContext) {
463-
try {
464-
return mechanism.getCredentialTransport(routingContext);
465-
} catch (UnsupportedOperationException ex) {
466-
return Uni.createFrom().item(mechanism.getCredentialTransport());
467-
}
468-
}
469-
470461
private static void rememberAuthAttempted(RoutingContext routingContext) {
471462
routingContext.put(ATTEMPT_AUTH_INVOKED, TRUE);
472463
}
@@ -489,7 +480,7 @@ private static boolean authenticatedWithDifferentAuthMechanism(String newAuthMec
489480
* when the selected mechanism is same as the one already used.
490481
*/
491482
private static Uni<HttpCredentialTransport> rememberAuthMechScheme(HttpAuthenticationMechanism mech, RoutingContext event) {
492-
return getCredentialTransport(mech, event)
483+
return mech.getCredentialTransport(event)
493484
.onItem().ifNotNull().invoke(new Consumer<HttpCredentialTransport>() {
494485
@Override
495486
public void accept(HttpCredentialTransport t) {

0 commit comments

Comments
 (0)