how to return claims without blocking the webclient call

18 Views Asked by At
public Claims getTokenClaims(String token) {

    getIssuerDetails().flatMap(i -> {

                return Jwts.parser()
                        .verifyWith(getPublicKeyFromString(i.getPublic_key()))
                        .build()
                        .parseSignedClaims(token)
                        .getPayload();
             
            }

           );
}

i'm making a webclient call getIssuerDetails, and the response of that contains publicKey which i'm trying to pass into a jwts.parser and return the Claims.

public Mono<KeycloakIssuerDetails> getIssuerDetails(){
    URI getPublicKeyURI = UriComponentsBuilder.fromHttpUrl(getIssuer()).build().toUri();

    return this.keycloakWebClient.get()
            .uri(getPublicKeyURI)
            .retrieve()
            .bodyToMono(KeycloakIssuerDetails.class);

}
0

There are 0 best solutions below