use of org.wso2.carbon.apimgt.impl.kmclient.model.OpenIDConnectDiscoveryClient in project carbon-apimgt by wso2.
the class KeyManagersApiServiceImpl method keyManagersDiscoverPost.
@Override
public Response keyManagersDiscoverPost(String url, String type, MessageContext messageContext) throws APIManagementException {
if (StringUtils.isNotEmpty(url)) {
Gson gson = new GsonBuilder().serializeNulls().create();
OpenIDConnectDiscoveryClient openIDConnectDiscoveryClient = Feign.builder().client(new ApacheFeignHttpClient(APIUtil.getHttpClient(url))).encoder(new GsonEncoder(gson)).decoder(new GsonDecoder(gson)).errorDecoder(new KMClientErrorDecoder()).target(OpenIDConnectDiscoveryClient.class, url);
OpenIdConnectConfiguration openIdConnectConfiguration = openIDConnectDiscoveryClient.getOpenIdConnectConfiguration();
if (openIdConnectConfiguration != null) {
KeyManagerWellKnownResponseDTO keyManagerWellKnownResponseDTO = KeyManagerMappingUtil.fromOpenIdConnectConfigurationToKeyManagerConfiguration(openIdConnectConfiguration);
keyManagerWellKnownResponseDTO.getValue().setWellKnownEndpoint(url);
keyManagerWellKnownResponseDTO.getValue().setType(type);
return Response.ok().entity(keyManagerWellKnownResponseDTO).build();
}
}
return Response.ok(new KeyManagerWellKnownResponseDTO()).build();
}
Aggregations