Skip to content

Commit

Permalink
Merge pull request #25137 from sberyozkin/mtls_securityidentity_test
Browse files Browse the repository at this point in the history
  • Loading branch information
gastaldi authored Apr 25, 2022
2 parents 9c1bb22 + 93d7092 commit 5eb3169
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,23 @@
import java.util.Arrays;
import java.util.stream.Collectors;

import javax.inject.Inject;
import javax.ws.rs.GET;
import javax.ws.rs.Path;

import io.quarkus.security.identity.SecurityIdentity;

@Path("/jsse")
public class BouncyCastleJsseEndpoint {

@Inject
SecurityIdentity identity;

@GET
@Path("listProviders")
public String listProviders() {
return Arrays.asList(Security.getProviders()).stream()
.map(p -> p.getName()).collect(Collectors.joining(","));
return "Identity: " + identity.getPrincipal().getName()
+ ", providers:" + Arrays.asList(Security.getProviders()).stream()
.map(p -> p.getName()).collect(Collectors.joining(","));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import static org.awaitility.Awaitility.given;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.startsWith;
import static org.junit.jupiter.api.Assertions.assertTrue;

import java.io.BufferedReader;
Expand Down Expand Up @@ -52,7 +53,7 @@ protected void doTestListProviders() {
.get("/jsse/listProviders")
.then()
.statusCode(200)
.body(containsString("BC,BCJSSE,SunJSSE"));
.body(startsWith("Identity: CN=client"), containsString("BC,BCJSSE,SunJSSE"));
}

protected void checkLog(boolean serverOnly) {
Expand Down

0 comments on commit 5eb3169

Please sign in to comment.