All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.scribejava.apis.salesforce.SalesforceJsonTokenExtractor Maven / Gradle / Ivy

There is a newer version: 8.3.3
Show newest version
package com.github.scribejava.apis.salesforce;

import com.fasterxml.jackson.databind.JsonNode;
import com.github.scribejava.core.extractors.OAuth2AccessTokenJsonExtractor;

/**
 * This extractor parses in addition to the standard Extractor the instance_url
 * of the used Salesforce organization.
 */
public class SalesforceJsonTokenExtractor extends OAuth2AccessTokenJsonExtractor {

    protected SalesforceJsonTokenExtractor() {
    }

    private static class InstanceHolder {

        private static final SalesforceJsonTokenExtractor INSTANCE = new SalesforceJsonTokenExtractor();
    }

    public static SalesforceJsonTokenExtractor instance() {
        return InstanceHolder.INSTANCE;
    }

    @Override
    protected SalesforceToken createToken(String accessToken, String tokenType, Integer expiresIn,
            String refreshToken, String scope, JsonNode response, String rawResponse) {
        return new SalesforceToken(accessToken, tokenType, expiresIn, refreshToken, scope,
                extractRequiredParameter(response, "instance_url", rawResponse).asText(), rawResponse);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy