components/global/core/io.cellery.observability.api/src/main/java/io/cellery/observability/api/auth/OIDCOauthManager.java
private JSONObject retrieveExistingClientCredentials() throws OIDCProviderException {
        try {
            String dcrEp = CelleryConfig.getInstance().getIdpURL() + Constants.IDP_REGISTERATION_ENDPOINT;
            HttpGet request = new HttpGet(dcrEp + "?"
                    + Constants.CLIENT_NAME_PARAM + "=" + Constants.APPLICATION_NAME);
            request.setHeader(Constants.AUTHORIZATION, getEncodedIdpAdminCredentials());

            HttpClient client = Utils.getTrustAllClient();
            HttpResponse response = client.execute(request);
            String result = EntityUtils.toString(response.getEntity());

            if (response.getStatusLine().getStatusCode() == 200 && result.contains(Constants.CLIENT_ID_TXT)) {
                return new JSONObject(result);
            } else {
                throw new OIDCProviderException("Error while retrieving client credentials." +
                        " Expected client credentials are not found in the response");
            }
        } catch (IOException | ParseException | NoSuchAlgorithmException | KeyManagementException |
                ConfigurationException e) {
            throw new OIDCProviderException("Error occurred while retrieving the client credentials with name " +
                    Constants.APPLICATION_NAME, e);
        }
    }
/**
     * Retrieve the existing credentials for the Observability Portal Client.
     *
     * @return the credentials returned in JSON format
     * @throws OIDCProviderException if retrieving existing client credentials fails
     */
Retrieve the existing credentials for the Observability Portal Client.
@return the credentials returned in JSON format
@throws OIDCProviderException if retrieving existing client credentials fails
Retrieve the existing credentials for the Observability Portal Client . @return the credentials returned in JSON format @throws OIDCProviderException if retrieving existing client credentials fails
private JSONObject retrieveExistingClientCredentials() throws OIDCProviderException {
        try {
            String dcrEp = CelleryConfig.getInstance().getIdpURL() + Constants.IDP_REGISTERATION_ENDPOINT;
            HttpGet request = new HttpGet(dcrEp + "?"
                    + Constants.CLIENT_NAME_PARAM + "=" + Constants.APPLICATION_NAME);
            request.setHeader(Constants.AUTHORIZATION, getEncodedIdpAdminCredentials());
            HttpClient client = Utils.getTrustAllClient();
            HttpResponse response = client.execute(request);
            String result = EntityUtils.toString(response.getEntity());
            if (response.getStatusLine().getStatusCode() == 200 && result.contains(Constants.CLIENT_ID_TXT)) {
                return new JSONObject(result);
            } else {
                throw new OIDCProviderException("Error while retrieving client credentials." +
                        " Expected client credentials are not found in the response");
            }
        } catch (IOException | ParseException | NoSuchAlgorithmException | KeyManagementException |
                ConfigurationException e) {
            throw new OIDCProviderException("Error occurred while retrieving the client credentials with name " +
                    Constants.APPLICATION_NAME, e);
        }
    }
private JSONObject retrieveExistingClientCredentials ( ) throws OIDCProviderException { try { String dcrEp = CelleryConfig . getInstance ( ) . getIdpURL ( ) + Constants . IDP_REGISTERATION_ENDPOINT ; HttpGet request = new HttpGet ( dcrEp + "?" + Constants . CLIENT_NAME_PARAM + "=" + Constants . APPLICATION_NAME ) ; request . setHeader ( Constants . AUTHORIZATION , getEncodedIdpAdminCredentials ( ) ) ; HttpClient client = Utils . getTrustAllClient ( ) ; HttpResponse response = client . execute ( request ) ; String result = EntityUtils . toString ( response . getEntity ( ) ) ; if ( response . getStatusLine ( ) . getStatusCode ( ) == 200 && result . contains ( Constants . CLIENT_ID_TXT ) ) { return new JSONObject ( result ) ; } else { throw new OIDCProviderException ( "Error while retrieving client credentials." + " Expected client credentials are not found in the response" ) ; } } catch ( IOException | ParseException | NoSuchAlgorithmException | KeyManagementException | ConfigurationException e ) { throw new OIDCProviderException ( "Error occurred while retrieving the client credentials with name " + Constants . APPLICATION_NAME , e ) ; } }
Retrieve the existing credentials for the Observability Portal Client.
Retrieve the existing credentials for the Observability Portal Client .