You are here

public function Salesforce::getIdentity in Salesforce Suite 7.3

Return the Salesforce identity, which is stored in a variable.

Return value

array Returns FALSE is no identity has been stored.

Throws

SalesforceException

1 call to Salesforce::getIdentity()
Salesforce::getApiEndPoint in includes/salesforce.inc
Get the API end point for a given type of the API.

File

includes/salesforce.inc, line 388
Objects, properties, and methods to communicate with the Salesforce REST API

Class

Salesforce
Ability to authorize and communicate with the Salesforce REST API.

Code

public function getIdentity() {
  $identity = variable_get('salesforce_identity', FALSE);
  if ($identity) {
    $id_url_scheme = parse_url($identity['id']);
    $allowed_endpoint = variable_get('salesforce_endpoint', NULL);
    $allowed_endpoint_url_scheme = parse_url($allowed_endpoint);
    if ($id_url_scheme['host'] != $allowed_endpoint_url_scheme['host']) {
      throw new SalesforceException(t('Salesforce identity does not match salesforce endpoint: you need to re-authenticate.'));
    }
  }
  return $identity;
}