@unito/integration-cli 0.61.2 → 0.62.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -164,8 +164,8 @@
164
164
  "grantType": {
165
165
  "type": "string",
166
166
  "description": "The type of grant of the OAuth 2 authorization.",
167
- "enum": ["authorization_code", "password", "client_credentials"],
168
- "tsEnumNames": ["AUTHORIZATION_CODE", "PASSWORD", "CLIENT_CREDENTIALS"]
167
+ "enum": ["authorization_code", "password", "client_credentials", "urn:ietf:params:oauth:grant-type:jwt-bearer"],
168
+ "tsEnumNames": ["AUTHORIZATION_CODE", "PASSWORD", "CLIENT_CREDENTIALS", "JWT_BEARER"]
169
169
  },
170
170
  "scopes": {
171
171
  "type": "array",
@@ -195,7 +195,8 @@ export declare enum Method {
195
195
  export declare enum GrantType {
196
196
  AUTHORIZATION_CODE = "authorization_code",
197
197
  PASSWORD = "password",
198
- CLIENT_CREDENTIALS = "client_credentials"
198
+ CLIENT_CREDENTIALS = "client_credentials",
199
+ JWT_BEARER = "urn:ietf:params:oauth:grant-type:jwt-bearer"
199
200
  }
200
201
  /**
201
202
  * The content type of exchanged information with the provider
@@ -23,6 +23,7 @@ var GrantType;
23
23
  GrantType["AUTHORIZATION_CODE"] = "authorization_code";
24
24
  GrantType["PASSWORD"] = "password";
25
25
  GrantType["CLIENT_CREDENTIALS"] = "client_credentials";
26
+ GrantType["JWT_BEARER"] = "urn:ietf:params:oauth:grant-type:jwt-bearer";
26
27
  })(GrantType || (exports.GrantType = GrantType = {}));
27
28
  /**
28
29
  * The content type of exchanged information with the provider
@@ -120,6 +120,11 @@ class OAuth2Service {
120
120
  ...(this.clientId && { client_id: this.clientId }),
121
121
  ...(this.clientSecret && { client_secret: this.clientSecret }),
122
122
  };
123
+ if (this.grantType === configurationTypes_1.GrantType.JWT_BEARER && this.clientSecret) {
124
+ tokenRequestPayload.client_assertion = this.clientSecret;
125
+ tokenRequestPayload.client_assertion_type = 'urn:ietf:params:oauth:client-assertion-type:jwt-bearer';
126
+ tokenRequestPayload.assertion = req.query.code;
127
+ }
123
128
  const tokenRequestHeaders = {
124
129
  'Content-Type': this.requestContentType,
125
130
  ...Object.fromEntries(Object.entries(this.tokenRequestParameters?.header ?? {}).map(([key, value]) => [
@@ -195,6 +200,12 @@ class OAuth2Service {
195
200
  if (this.clientSecret) {
196
201
  bodyData.client_secret = this.clientSecret;
197
202
  }
203
+ if (this.grantType === configurationTypes_1.GrantType.JWT_BEARER && this.clientSecret) {
204
+ bodyData.client_assertion = this.clientSecret;
205
+ bodyData.assertion = refreshToken;
206
+ bodyData.client_assertion_type = 'urn:ietf:params:oauth:client-assertion-type:jwt-bearer';
207
+ bodyData.redirect_uri = `${IntegrationsPlatformClient.Servers[this.environment]}/credentials/new/oauth2/callback-cli`;
208
+ }
198
209
  try {
199
210
  const tokenResponse = await fetch(this.tokenUrl, {
200
211
  headers: {
@@ -0,0 +1 @@
1
+ {"root":["../src/baseCommand.ts","../src/configurationTypes.ts","../src/errors.ts","../src/index.ts","../src/commands/activity.ts","../src/commands/dev.ts","../src/commands/encrypt.ts","../src/commands/init.ts","../src/commands/invite.ts","../src/commands/login.ts","../src/commands/oauth2.ts","../src/commands/publish.ts","../src/commands/test.ts","../src/commands/upgrade.ts","../src/hooks/init/displayLogo.ts","../src/resources/configuration.ts","../src/resources/credentials.ts","../src/resources/decryption.ts","../src/resources/fileSystem.ts","../src/resources/globalConfiguration.ts","../src/resources/integrations.ts","../src/resources/integrationsPlatform.ts","../src/resources/oauth2.ts","../src/resources/template.ts","../src/services/integrationsPlatform.ts","../src/services/integrationsPlatformClient.ts","../src/services/oauth2.ts","../test/errors.test.ts","../test/commands/activity.test.ts","../test/commands/dev.test.ts","../test/commands/encrypt.test.ts","../test/commands/init.test.ts","../test/commands/invite.test.ts","../test/commands/login.test.ts","../test/commands/oauth2.test.ts","../test/commands/publish.test.ts","../test/commands/test.test.ts","../test/commands/upgrade.test.ts","../test/helpers/init.js","../test/helpers/integrations.ts","../test/helpers/styles.ts","../test/resources/configuration.test.ts","../test/resources/decryption.test.ts","../test/resources/globalConfiguration.test.ts","../test/resources/integrations.test.ts","../test/resources/oauth2.test.ts","../test/resources/template.test.ts","../test/services/integrationsPlatform.test.ts","../test/services/oauth2.test.ts","../scripts/generateTypes.ts","../.eslintrc.js"],"version":"5.6.3"}
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.61.2",
2
+ "version": "0.62.0",
3
3
  "commands": {
4
4
  "activity": {
5
5
  "id": "activity",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unito/integration-cli",
3
- "version": "0.61.2",
3
+ "version": "0.62.0",
4
4
  "description": "Integration CLI",
5
5
  "bin": {
6
6
  "integration-cli": "./bin/run"