private Optional<JsonWebKeySet> buildJsonWebKeySet(
        final String json, final Optional<String> keyId,
        final Optional<OidcJsonWebKeyUsage> usage) throws Exception {
        if (JsonUtils.isValidJson(json)) {
            return getJsonWebKeyFromJsonWebKeySet(new JsonWebKeySet(json), keyId, usage);
        }
        val key = new AesKey(json.getBytes(StandardCharsets.UTF_8));
        val jsonWebKey = new OctetSequenceJsonWebKey(key);
        jsonWebKey.setKeyId(keyId.orElse(StringUtils.EMPTY));
        jsonWebKey.setUse(usage.map(Enum::name).orElse(StringUtils.EMPTY));
        return Optional.of(new JsonWebKeySet(jsonWebKey));
    }
Gets json web key from jwks.

@param jwks         the jwks
@param requestedKey the kid
@param usage        the usage
@return the json web key from jwks
support/cas-server-support-oidc-core-api/src/main/java/org/apereo/cas/oidc/jwks/OidcJsonWebKeyStoreUtils.java