code: private Credential getCredential(
        AccessTokenProviderClassFromConfigFactory providerClassFactory, Configuration config)
        throws IOException, GeneralSecurityException {
      Credential credential = null;
  
      // Check if delegation token support is configured
      if (delegationTokens != null) {
        // If so, use the delegation token to acquire the Google credentials
        AccessTokenProvider atp = delegationTokens.getAccessTokenProvider();
        if (atp != null) {
          atp.setConf(config);
          credential =
              CredentialFromAccessTokenProviderClassFactory.credential(
                  atp, CredentialFactory.GCS_SCOPES);
        }
      } else {
        // If delegation token support is not configured, check if a
        // custom AccessTokenProvider implementation is configured, and attempt
        // to acquire the Google credentials using it
        credential =
            CredentialFromAccessTokenProviderClassFactory.credential(
                providerClassFactory, config, CredentialFactory.GCS_SCOPES);
  
        if (credential == null) {
          // Finally, if no credentials have been acquired at this point, employ
          // the default mechanism.
          credential =
              HadoopCredentialConfiguration.newBuilder()
                  .withConfiguration(config)
                  .withOverridePrefix(AUTHENTICATION_PREFIX)
                  .build()
                  .getCredential(CredentialFactory.GCS_SCOPES);
        }
      }
  
      return credential;
    }
docs: Retrieve user's Credential. If user implemented {@link AccessTokenProvider} and provided the
  class name (See {@link AccessTokenProviderClassFromConfigFactory} then build a credential with
  access token provided by this provider; Otherwise obtain credential through {@link
  HadoopCredentialConfiguration#getCredential(List)}.