Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set 'Client Application' under 'Client Info' #286

Merged
merged 3 commits into from
Apr 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions lib/authentication/authentication.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ exports.formAuthJSON = function formAuthJSON(
username,
clientName,
clientVersion,
clientApplication,
clientEnv
)
{
Expand All @@ -49,7 +48,6 @@ exports.formAuthJSON = function formAuthJSON(
LOGIN_NAME: username,
CLIENT_APP_ID: clientName,
CLIENT_APP_VERSION: clientVersion,
CLIENT_APP_NAME: clientApplication,
CLIENT_ENVIRONMENT:
{
OS: clientEnv.OS,
Expand Down
2 changes: 0 additions & 2 deletions lib/connection/connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,6 @@ function Connection(context)
connectionConfig.username,
connectionConfig.getClientName(),
connectionConfig.getClientVersion(),
connectionConfig.getClientApplication(),
connectionConfig.getClientEnvironment());

// Update JSON body with the authentication values
Expand Down Expand Up @@ -272,7 +271,6 @@ function Connection(context)
connectionConfig.username,
connectionConfig.getClientName(),
connectionConfig.getClientVersion(),
connectionConfig.getClientApplication(),
connectionConfig.getClientEnvironment());

// Update JSON body with the authentication values
Expand Down
7 changes: 6 additions & 1 deletion lib/services/sf.js
Original file line number Diff line number Diff line change
Expand Up @@ -1079,7 +1079,6 @@ StateConnecting.prototype.continue = function ()
{
CLIENT_APP_ID: this.connectionConfig.getClientType(),
CLIENT_APP_VERSION: this.connectionConfig.getClientVersion(),
CLIENT_APP_NAME: this.connectionConfig.getClientApplication()
};

// if we have some information about the client environment, add it as well
Expand All @@ -1089,6 +1088,12 @@ StateConnecting.prototype.continue = function ()
clientInfo.CLIENT_ENVIRONMENT = clientEnvironment;
}

var clientApplication = this.connectionConfig.getClientApplication();
if (Util.isString(clientApplication))
{
clientEnvironment["APPLICATION"] = clientApplication;
}

var sessionParameters =
{
SESSION_PARAMETERS: {}
Expand Down
10 changes: 5 additions & 5 deletions test/unit/authentication/authentication_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ describe('default authentication', function ()
var body = authenticator.formAuthJSON(connectionOptionsDefault.authenticator,
connectionOptionsDefault.account,
connectionOptionsDefault.username,
{}, {}, {}, {});
{}, {}, {});

assert.strictEqual(
body['data']['AUTHENTICATOR'], authenticationTypes.DEFAULT_AUTHENTICATOR, 'Authenticator should be SNOWFLAKE');
Expand Down Expand Up @@ -155,7 +155,7 @@ describe('external browser authentication', function ()
var body = authenticator.formAuthJSON(connectionOptionsExternalBrowser.authenticator,
connectionOptionsExternalBrowser.account,
connectionOptionsExternalBrowser.username,
{}, {}, {}, {});
{}, {}, {});

assert.strictEqual(
body['data']['AUTHENTICATOR'], authenticationTypes.EXTERNAL_BROWSER_AUTHENTICATOR, 'Authenticator should be EXTERNALBROWSER');
Expand Down Expand Up @@ -300,7 +300,7 @@ describe('key-pair authentication', function ()
var body = authenticator.formAuthJSON(connectionOptionsKeyPair.authenticator,
connectionOptionsKeyPair.account,
connectionOptionsKeyPair.username,
{}, {}, {}, {});
{}, {}, {});

assert.strictEqual(
body['data']['AUTHENTICATOR'], authenticationTypes.KEY_PAIR_AUTHENTICATOR, 'Authenticator should be SNOWFLAKE_JWT');
Expand All @@ -325,7 +325,7 @@ describe('oauth authentication', function ()
var body = authenticator.formAuthJSON(connectionOptionsOauth.authenticator,
connectionOptionsOauth.account,
connectionOptionsOauth.username,
{}, {}, {}, {});
{}, {}, {});

assert.strictEqual(
body['data']['AUTHENTICATOR'], authenticationTypes.OAUTH_AUTHENTICATOR, 'Authenticator should be OAUTH');
Expand Down Expand Up @@ -502,7 +502,7 @@ describe('okta authentication', function ()
var body = authenticator.formAuthJSON(connectionOptionsOkta.authenticator,
connectionOptionsOkta.account,
connectionOptionsOkta.username,
{}, {}, {}, {});
{}, {}, {});

assert.strictEqual(
body['data']['AUTHENTICATOR'], 'https://dev-12345678.okta.com/' , 'Authenticator should be OAUTH');
Expand Down