class SpringOidcConfigurationService implements OidcConfigurationService {

	@Override
	public OAuth2ServiceEndpointsProvider retrieveEndpoints(@Nonnull URI discoveryEndpointUri)
			throws OAuth2ServiceException {
		Assertions.assertNotNull(discoveryEndpointUri, "discoveryEndpointUri must not be null!");
		try {
			ResponseEntity<String> response = restOperations.getForEntity(discoveryEndpointUri, String.class);
			if (HttpStatus.OK.value() == response.getStatusCode().value()) {
				return new DefaultOidcConfigurationService.OidcEndpointsProvider(response.getBody());
			} else {
				throw OAuth2ServiceException.builder("Error retrieving configured oidc endpoints")
						.withUri(discoveryEndpointUri)
						.withStatusCode(response.getStatusCodeValue())
						.withResponseBody(response.getBody())
						.build();
			}
		} catch (HttpClientErrorException ex) {
			throw OAuth2ServiceException.builder("Error retrieving configured oidc endpoints")
					.withUri(discoveryEndpointUri)
					.withStatusCode(ex.getStatusCode().value())
					.withResponseBody(ex.getResponseBodyAsString())
					.build();
		}
	}

	public  SpringOidcConfigurationService(@Nonnull RestOperations restOperations);

}