Skip to content

Commit

Permalink
fix: deploy - oauth
Browse files Browse the repository at this point in the history
  • Loading branch information
abdul99ahad committed Jan 14, 2025
1 parent 88f3550 commit 47af2e8
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 23 deletions.
16 changes: 8 additions & 8 deletions app/lib/zeebe-api/zeebe-api.js
Original file line number Diff line number Diff line change
Expand Up @@ -350,14 +350,14 @@ class ZeebeAPI {
} else if (authType === AUTH_TYPES.OAUTH) {
options = {
...options,
oAuth: {
url: endpoint.oauthURL,
audience: endpoint.audience,
scope: endpoint.scope,
clientId: endpoint.clientId,
clientSecret: endpoint.clientSecret,
cacheOnDisk: false
}
CAMUNDA_AUTH_STRATEGY: 'OAUTH',
ZEEBE_GRPC_ADDRESS: endpoint.url,
ZEEBE_CLIENT_ID: endpoint.clientId,
ZEEBE_CLIENT_SECRET: endpoint.clientSecret,
CAMUNDA_OAUTH_URL: endpoint.oauthURL,
CAMUNDA_TOKEN_SCOPE: endpoint.scope,
CAMUNDA_CONSOLE_OAUTH_AUDIENCE: endpoint.audience,
CAMUNDA_TOKEN_DISK_CACHE_DISABLE: true
};
} else if (type === ENDPOINT_TYPES.CAMUNDA_CLOUD) {
options = {
Expand Down
30 changes: 15 additions & 15 deletions app/test/spec/zeebe-api/zeebe-api-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1189,16 +1189,14 @@ describe('ZeebeAPI', function() {
it('should pass configuration', async function() {

// given
const configSpy = sinon.spy();
const deployResourceSpy = sinon.spy();

const ZBClientMock = sinon.spy(function() {
return {
deployResource: deployResourceSpy
};
});

const zeebeAPI = mockCamundaClient({
ZBClient: ZBClientMock
configSpy,
ZBClient: {
deployResource: deployResourceSpy
}
});

// when
Expand All @@ -1218,17 +1216,19 @@ describe('ZeebeAPI', function() {
});

// then
const [ url, config ] = ZBClientMock.getCall(0).args;
const config = configSpy.getCall(0).args[0];

// ZBClient is invoked accordingly
expect(url).to.eql(TEST_URL);
expect(config.ZEEBE_GRPC_ADDRESS).to.eql(TEST_URL);

expect(config.oAuth).to.include.keys({
audience: 'audience',
clientId: 'clientId',
clientSecret: 'clientSecret',
scope: 'scope',
url: 'oauthURL'
expect(config).to.include.keys({
CAMUNDA_AUTH_STRATEGY: 'OAUTH',
CAMUNDA_CONSOLE_OAUTH_AUDIENCE: 'audience',
ZEEBE_CLIENT_ID: 'clientId',
ZEEBE_CLIENT_SECRET: 'clientSecret',
CAMUNDA_TOKEN_SCOPE: 'scope',
CAMUNDA_OAUTH_URL: 'oauthURL',
CAMUNDA_TOKEN_DISK_CACHE_DISABLE: 'true'
});

// deployment is executed appropriately
Expand Down

0 comments on commit 47af2e8

Please sign in to comment.