ConnectionParams Class

Contains the credentials for authenticating to the external system.

DataSource

If your extension of the DataSource.Provider class returns DataSource.AuthenticationCapability values that indicate support for authentication, the DataSource.Connection class is instantiated with a DataSource.ConnectionParams instance in the constructor.

The authentication credentials in the DataSource.ConnectionParams instance depend on the Identity Type field of the external data source definition in Salesforce.

  • If Identity Type is set to Named Principal, the credentials come from the external data source definition.

  • If Identity Type is set to Per User:

    • For queries and searches, the credentials are specific to the current user who invokes the query or search. The credentials come from the user’s authentication settings for the external system.
    • For administrative connections, such as syncing the external system’s schema, the credentials come from the external data source definition.

The values in this class can appear in debug logs and can be accessed by users who have the “Author Apex” permission. If you require better security, we recommend that you specify named credentials instead of URLs as your Apex callout endpoints. Salesforce manages all authentication for Apex callouts that specify a named credential as the callout endpoint so that your code doesn’t have to.

The following are properties for ConnectionParams.

  • certificateName

    The name of the certificate for establishing each connection to the external system.

  • endpoint

    The URL of the external system.

  • oauthToken

    The OAuth token that’s issued by the external system.

  • password

    The password for authenticating to the external system.

  • principalType

    An instance of DataSource.IdentityType, which determines which set of credentials to use to access the external system.

  • protocol

    The type of protocol that’s used to authenticate to the external system.

  • repository

    Reserved for future use.

  • username

    The username for authenticating to the external system.

The name of the certificate for establishing each connection to the external system.

public String certificateName {get; set;}

Type: String

The value comes from the external data source definition in Salesforce.

The URL of the external system.

public String endpoint {get; set;}

Type: String

The value comes from the external data source definition in Salesforce.

The OAuth token that’s issued by the external system.

public String oauthToken {get; set;}

Type: String

The password for authenticating to the external system.

public String password {get; set;}

Type: String

The value depends on the Identity Type field of the external data source definition in Salesforce.

  • If Identity Type is set to Named Principal, the credentials come from the external data source definition.

  • If Identity Type is set to Per User:

    • For queries and searches, the credentials are specific to the current user who invokes the query or search. The credentials come from the user’s authentication settings for the external system.
    • For administrative connections, such as syncing the external system’s schema, the credentials come from the external data source definition.

An instance of DataSource.IdentityType, which determines which set of credentials to use to access the external system.

public DataSource.IdentityType principalType {get; set;}

Type: DataSource.IdentityType

The type of protocol that’s used to authenticate to the external system.

public DataSource.AuthenticationProtocol protocol {get; set;}

Type: DataSource.AuthenticationProtocol

Reserved for future use.

public String repository {get; set;}

Type: String

Reserved for future use.

The username for authenticating to the external system.

public String username {get; set;}

Type: String

The value depends on the Identity Type field of the external data source definition in Salesforce.

  • If Identity Type is set to Named Principal, the credentials come from the external data source definition.

  • If Identity Type is set to Per User:

    • For queries and searches, the credentials are specific to the current user who invokes the query or search. The credentials come from the user’s authentication settings for the external system.
    • For administrative connections, such as syncing the external system’s schema, the credentials come from the external data source definition.