/** * Loads a JSON Web Key (JWK) set from the specified URL. * * @param url The JWK set URL. Must not be {@code null}. * @param connectTimeout The URL connection timeout, in milliseconds. * If zero no (infinite) timeout. * @param readTimeout The URL read timeout, in milliseconds. If zero * no (infinite) timeout. * @param sizeLimit The read size limit, in bytes. If zero no * limit. * * @return The JWK set. * * @throws IOException If the file couldn't be read. * @throws ParseException If the file couldn't be parsed to a valid * JSON Web Key (JWK) set. */ public static JWKSet load(final URL url, final int connectTimeout, final int readTimeout, final int sizeLimit) throws IOException, ParseException { RestrictedResourceRetriever resourceRetriever = new DefaultResourceRetriever( connectTimeout, readTimeout, sizeLimit); Resource resource = resourceRetriever.retrieveResource(url); return parse(resource.getContent()); }