private JwtReader getReader(String jwt, Clock clock) throws JwsUnsupportedAlgorithmException, JwtUnknownIssuerException, JwtParseException, JwtIssuerLacksSharedSecretException { SimpleUnverifiedJwt unverifiedJwt = new NimbusUnverifiedJwtReader().parse(jwt); SigningAlgorithm algorithm = validateAlgorithm(unverifiedJwt); String issuer = validateIssuer(unverifiedJwt); if (algorithm.requiresSharedSecret()) { return macVerifyingReader(issuer, jwtIssuerSharedSecretService.getSharedSecret(issuer), clock); } throw new JwsUnsupportedAlgorithmException(String.format("Expected a symmetric signing algorithm such as %s, and not %s. Try a symmetric algorithm.", SigningAlgorithm.HS256, algorithm.name())); }