Skip to content

Commit

Permalink
Merge pull request #4305 from stuartwdouglas/security-fixes
Browse files Browse the repository at this point in the history
Fixes for JWT auth
  • Loading branch information
stuartwdouglas authored Oct 2, 2019
2 parents c93aa03 + 2a93978 commit eb6e47c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ public CompletionStage<SecurityIdentity> authenticate(TokenAuthenticationRequest

} catch (ParseException | MalformedClaimException e) {
log.debug("Authentication failed", e);
throw new AuthenticationFailedException();
CompletableFuture<SecurityIdentity> cf = new CompletableFuture<SecurityIdentity>();
cf.completeExceptionally(new AuthenticationFailedException());
return cf;
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package io.quarkus.vertx.http.runtime.security;

import java.util.concurrent.CompletionException;
import java.util.function.BiFunction;

import javax.enterprise.inject.spi.CDI;
Expand All @@ -25,6 +26,9 @@ public void handle(RoutingContext event) {
@Override
public Object apply(SecurityIdentity identity, Throwable throwable) {
if (throwable != null) {
while (throwable instanceof CompletionException && throwable.getCause() != null) {
throwable = throwable.getCause();
}
//auth failed
if (throwable instanceof AuthenticationFailedException) {
authenticator.sendChallenge(event, new Runnable() {
Expand Down

0 comments on commit eb6e47c

Please sign in to comment.