Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TokenVerifier: execute blocking calls in parallel #3728

Merged
merged 3 commits into from
Mar 4, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion control-plane/pkg/contract/contract.pb.go
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think changes on this file are not needed for this change

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@creydr It's automatically updated, removed the changes as suggested :)

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -40,23 +40,25 @@
}

public Future<JwtClaims> verify(String token, String expectedAudience) {
return this.vertx.<JwtClaims>executeBlocking(promise -> {
// execute blocking, as jose .process() is blocking
return this.vertx.<JwtClaims>executeBlocking(

Check warning on line 43 in data-plane/core/src/main/java/dev/knative/eventing/kafka/broker/core/oidc/TokenVerifierImpl.java

View check run for this annotation

Codecov / codecov/patch

data-plane/core/src/main/java/dev/knative/eventing/kafka/broker/core/oidc/TokenVerifierImpl.java#L43

Added line #L43 was not covered by tests
promise -> {
// execute blocking, as jose .process() is blocking

JwtConsumer jwtConsumer = new JwtConsumerBuilder()
.setVerificationKeyResolver(this.oidcDiscoveryConfig.getJwksVerificationKeyResolver())
.setExpectedAudience(expectedAudience)
.setExpectedIssuer(this.oidcDiscoveryConfig.getIssuer())
.build();
JwtConsumer jwtConsumer = new JwtConsumerBuilder()
.setVerificationKeyResolver(this.oidcDiscoveryConfig.getJwksVerificationKeyResolver())
.setExpectedAudience(expectedAudience)
.setExpectedIssuer(this.oidcDiscoveryConfig.getIssuer())
.build();

Check warning on line 51 in data-plane/core/src/main/java/dev/knative/eventing/kafka/broker/core/oidc/TokenVerifierImpl.java

View check run for this annotation

Codecov / codecov/patch

data-plane/core/src/main/java/dev/knative/eventing/kafka/broker/core/oidc/TokenVerifierImpl.java#L47-L51

Added lines #L47 - L51 were not covered by tests

try {
JwtContext jwtContext = jwtConsumer.process(token);
try {
JwtContext jwtContext = jwtConsumer.process(token);

Check warning on line 54 in data-plane/core/src/main/java/dev/knative/eventing/kafka/broker/core/oidc/TokenVerifierImpl.java

View check run for this annotation

Codecov / codecov/patch

data-plane/core/src/main/java/dev/knative/eventing/kafka/broker/core/oidc/TokenVerifierImpl.java#L54

Added line #L54 was not covered by tests

promise.complete(jwtContext.getJwtClaims());
} catch (InvalidJwtException e) {
promise.fail(e);
}
});
promise.complete(jwtContext.getJwtClaims());
} catch (InvalidJwtException e) {
promise.fail(e);
}
},

Check warning on line 60 in data-plane/core/src/main/java/dev/knative/eventing/kafka/broker/core/oidc/TokenVerifierImpl.java

View check run for this annotation

Codecov / codecov/patch

data-plane/core/src/main/java/dev/knative/eventing/kafka/broker/core/oidc/TokenVerifierImpl.java#L56-L60

Added lines #L56 - L60 were not covered by tests
false);
}

public Future<JwtClaims> verify(final HttpServerRequest request, String expectedAudience) {
Expand Down
Loading