components/global/core/io.cellery.observability.api/src/main/java/io/cellery/observability/api/auth/OIDCOauthManager.java
public boolean validateToken(String token) throws OIDCProviderException {
        try {
            List<NameValuePair> params = new ArrayList<>();
            params.add(new BasicNameValuePair("token", token));

            String introspectEP = CelleryConfig.getInstance().getIdpURL() + Constants.INTROSPECT_ENDPOINT;
            HttpPost request = new HttpPost(introspectEP);
            request.setHeader(Constants.AUTHORIZATION, getEncodedIdpAdminCredentials());
            request.setEntity(new UrlEncodedFormEntity(params, StandardCharsets.UTF_8.name()));

            HttpClient client = Utils.getTrustAllClient();
            HttpResponse response = client.execute(request);
            int statusCode = response.getStatusLine().getStatusCode();
            if (statusCode >= 200 && statusCode < 400) {
                JSONObject jsonObject = new JSONObject(EntityUtils.toString(response.getEntity()));
                if (!jsonObject.getBoolean(ACTIVE_STATUS)) {
                    return false;
                }
            } else {
                logger.error("Failed to connect to Introspect endpoint in Identity Provider server." +
                        " Exited with Status Code " + statusCode);
                return false;
            }
        } catch (IOException | ParseException | NoSuchAlgorithmException | KeyManagementException |
                ConfigurationException e) {
            throw new OIDCProviderException("Error occurred while calling the introspect endpoint", e);
        }
        return true;
    }
/**
     * Validate the token.
     *
     * @param token This will be the access token
     * @return the boolean status of the validity of the access token
     * @throws OIDCProviderException if validating the token fails
     */
Validate the token.
@param token This will be the access token
@return the boolean status of the validity of the access token
@throws OIDCProviderException if validating the token fails
Validate the token . @param token This will be the access token @return the boolean status of the validity of the access token @throws OIDCProviderException if validating the token fails
public boolean validateToken(String token) throws OIDCProviderException {
        try {
            List<NameValuePair> params = new ArrayList<>();
            params.add(new BasicNameValuePair("token", token));
            String introspectEP = CelleryConfig.getInstance().getIdpURL() + Constants.INTROSPECT_ENDPOINT;
            HttpPost request = new HttpPost(introspectEP);
            request.setHeader(Constants.AUTHORIZATION, getEncodedIdpAdminCredentials());
            request.setEntity(new UrlEncodedFormEntity(params, StandardCharsets.UTF_8.name()));
            HttpClient client = Utils.getTrustAllClient();
            HttpResponse response = client.execute(request);
            int statusCode = response.getStatusLine().getStatusCode();
            if (statusCode >= 200 && statusCode < 400) {
                JSONObject jsonObject = new JSONObject(EntityUtils.toString(response.getEntity()));
                if (!jsonObject.getBoolean(ACTIVE_STATUS)) {
                    return false;
                }
            } else {
                logger.error("Failed to connect to Introspect endpoint in Identity Provider server." +
                        " Exited with Status Code " + statusCode);
                return false;
            }
        } catch (IOException | ParseException | NoSuchAlgorithmException | KeyManagementException |
                ConfigurationException e) {
            throw new OIDCProviderException("Error occurred while calling the introspect endpoint", e);
        }
        return true;
    }
public boolean validateToken ( String token ) throws OIDCProviderException { try { List < NameValuePair > params = new ArrayList < > ( ) ; params . add ( new BasicNameValuePair ( "token" , token ) ) ; String introspectEP = CelleryConfig . getInstance ( ) . getIdpURL ( ) + Constants . INTROSPECT_ENDPOINT ; HttpPost request = new HttpPost ( introspectEP ) ; request . setHeader ( Constants . AUTHORIZATION , getEncodedIdpAdminCredentials ( ) ) ; request . setEntity ( new UrlEncodedFormEntity ( params , StandardCharsets . UTF_8 . name ( ) ) ) ; HttpClient client = Utils . getTrustAllClient ( ) ; HttpResponse response = client . execute ( request ) ; int statusCode = response . getStatusLine ( ) . getStatusCode ( ) ; if ( statusCode >= 200 && statusCode < 400 ) { JSONObject jsonObject = new JSONObject ( EntityUtils . toString ( response . getEntity ( ) ) ) ; if ( ! jsonObject . getBoolean ( ACTIVE_STATUS ) ) { return false ; } } else { logger . error ( "Failed to connect to Introspect endpoint in Identity Provider server." + " Exited with Status Code " + statusCode ) ; return false ; } } catch ( IOException | ParseException | NoSuchAlgorithmException | KeyManagementException | ConfigurationException e ) { throw new OIDCProviderException ( "Error occurred while calling the introspect endpoint" , e ) ; } return true ; }
Validate the token.
Validate the token .