Skip to content

Commit d9af915

Browse files
committed
Handle cases where the client key is unknown
1 parent e96a35f commit d9af915

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/main/java/com/uid2/operator/vertx/GenericFailureHandler.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import com.uid2.shared.auth.IAuthorizable;
44
import com.uid2.shared.auth.OperatorKey;
55
import com.uid2.shared.middleware.AuthMiddleware;
6+
import com.uid2.shared.auth.ClientKey;
67
import io.vertx.core.Handler;
78
import io.vertx.core.http.HttpClosedException;
89
import io.vertx.core.http.HttpServerResponse;
@@ -22,7 +23,11 @@ public void handle(RoutingContext ctx) {
2223
String url = ctx.normalizedPath();
2324
Throwable t = ctx.failure();
2425

25-
final String contact = AuthMiddleware.getAuthClient(ctx).getContact();
26+
String contact = "unknown";
27+
final ClientKey clientKey = (ClientKey) AuthMiddleware.getAuthClient(ctx);
28+
if (clientKey != null) {
29+
contact = clientKey.getContact();
30+
}
2631

2732
if (t != null) {
2833
// Because Vert.x swallows stack traces so cannot log stack trace

0 commit comments

Comments
 (0)