You are here

class JWTCredentials in Salesforce Suite 8.4

Same name and namespace in other branches
  1. 5.0.x modules/salesforce_jwt/src/Consumer/JWTCredentials.php \Drupal\salesforce_jwt\Consumer\JWTCredentials

JWT credentials.

Hierarchy

Expanded class hierarchy of JWTCredentials

File

modules/salesforce_jwt/src/Consumer/JWTCredentials.php, line 10

Namespace

Drupal\salesforce_jwt\Consumer
View source
class JWTCredentials extends SalesforceCredentials {

  /**
   * Pre-authorized login user for JWT OAuth authentication.
   *
   * @var string
   */
  protected $loginUser;

  /**
   * Id of authorization key for this JWT Credential.
   *
   * @var string
   */
  protected $keyId;

  /**
   * {@inheritdoc}
   */
  public function __construct($consumerKey, $loginUrl, $loginUser, $keyId) {
    parent::__construct($consumerKey, NULL, NULL);
    $this->consumerKey = $consumerKey;
    $this->loginUrl = $loginUrl;
    $this->loginUser = $loginUser;
    $this->keyId = $keyId;
  }

  /**
   * Constructor helper.
   *
   * @param array $configuration
   *   Plugin configuration.
   *
   * @return \Drupal\salesforce_jwt\Consumer\JWTCredentials
   *   Credentials, valid or not.
   */
  public static function create(array $configuration) {
    return new static($configuration['consumer_key'], $configuration['login_url'], $configuration['login_user'], $configuration['encrypt_key']);
  }

  /**
   * Login user getter.
   *
   * @return string
   *   The login user.
   */
  public function getLoginUser() {
    return $this->loginUser;
  }

  /**
   * Authorization key getter.
   *
   * @return string
   *   The key id.
   */
  public function getKeyId() {
    return $this->keyId;
  }

  /**
   * {@inheritdoc}
   */
  public function isValid() {
    return !empty($this->loginUser) && !empty($this->consumerId) && !empty($this->keyId);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
JWTCredentials::$keyId protected property Id of authorization key for this JWT Credential.
JWTCredentials::$loginUser protected property Pre-authorized login user for JWT OAuth authentication.
JWTCredentials::create public static function Constructor helper. Overrides SalesforceCredentials::create
JWTCredentials::getKeyId public function Authorization key getter.
JWTCredentials::getLoginUser public function Login user getter.
JWTCredentials::isValid public function Sanity check for credentials validity. Overrides SalesforceCredentials::isValid
JWTCredentials::__construct public function
SalesforceCredentials::$consumerKey protected property Consumer key for the Salesforce connected OAuth app.
SalesforceCredentials::$loginUrl protected property Login URL e.g. https://test.salesforce.com or https://login.salesforce.com.
SalesforceCredentials::getConsumerKey public function Get the consumer key for these credentials. Overrides SalesforceCredentialsInterface::getConsumerKey
SalesforceCredentials::getLoginUrl public function Get the login URL for these credentials. Overrides SalesforceCredentialsInterface::getLoginUrl