From ae3fd7c91a2a7d27e7dd26490ae2ffc136cd2d2e Mon Sep 17 00:00:00 2001 From: Leandro Costa Date: Thu, 9 Nov 2023 00:04:24 -0300 Subject: [PATCH 1/4] fix: initilizando variavel forceTokenTypeToCamelCase --- src/lhisp-oauth-client.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/lhisp-oauth-client.ts b/src/lhisp-oauth-client.ts index 5e22a1b..fc13f49 100644 --- a/src/lhisp-oauth-client.ts +++ b/src/lhisp-oauth-client.ts @@ -59,6 +59,7 @@ export class LhispOauthClient { this.authHeaderName = params.authHeaderName || defaultAuthHeaderName; this.tokenHeaderName = params.tokenHeaderName || defaultTokenHeaderName; this.sendAuthCredentialsOnRequestBody = params.sendAuthCredentialsOnRequestBody; + this.forceTokenTypeToCamelCase = params.forceTokenTypeToCamelCase; } getAuthHeaderValue(): string { From aef30ee29ae3db82d8e640681db635add29ee6b7 Mon Sep 17 00:00:00 2001 From: bitbucket-pipelines Date: Thu, 9 Nov 2023 03:05:19 +0000 Subject: [PATCH 2/4] [skip CI] Version 1.0.22 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index cccb2e9..10a30d0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "lhisp-oauth-client", - "version": "1.0.21", + "version": "1.0.22", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "lhisp-oauth-client", - "version": "1.0.21", + "version": "1.0.22", "license": "MIT", "dependencies": { "axios": "^1.6.1", diff --git a/package.json b/package.json index e16a8e4..369e046 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "lhisp-oauth-client", - "version": "1.0.21", + "version": "1.0.22", "main": "src/index", "types": "src/index.d.ts", "repository": "git@bitbucket.org:leandro_costa/lhisp-oauth-client.git", From 64f546ab7a93a34a8238f2b214f957eb4ec09a4e Mon Sep 17 00:00:00 2001 From: Leandro Costa Date: Thu, 9 Nov 2023 12:17:14 -0300 Subject: [PATCH 3/4] feat: formatAccessToken --- src/lhisp-oauth-client.t.ts | 2 +- src/lhisp-oauth-client.ts | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/lhisp-oauth-client.t.ts b/src/lhisp-oauth-client.t.ts index 288fbe4..3ad36cc 100644 --- a/src/lhisp-oauth-client.t.ts +++ b/src/lhisp-oauth-client.t.ts @@ -18,7 +18,7 @@ export interface LhispOauthClientConstructorParams { grantType?: string; authContentType?: ContentType; sendAuthCredentialsOnRequestBody?: boolean; - forceTokenTypeToCamelCase?: boolean; + formatAccessToken?: (accessToken?: AccessToken) => string; debug?: boolean; } diff --git a/src/lhisp-oauth-client.ts b/src/lhisp-oauth-client.ts index fc13f49..cd0a8ef 100644 --- a/src/lhisp-oauth-client.ts +++ b/src/lhisp-oauth-client.ts @@ -32,7 +32,7 @@ export class LhispOauthClient { protected tokenCreatedAt = 0; protected tokenExpiresIn = 0; protected sendAuthCredentialsOnRequestBody?: boolean; - protected forceTokenTypeToCamelCase?: boolean; + protected formatAccessToken?: (accessToken?: iAccessToken) => string; constructor(params: LhispOauthClientConstructorParams) { if (params.certificado) { @@ -59,7 +59,7 @@ export class LhispOauthClient { this.authHeaderName = params.authHeaderName || defaultAuthHeaderName; this.tokenHeaderName = params.tokenHeaderName || defaultTokenHeaderName; this.sendAuthCredentialsOnRequestBody = params.sendAuthCredentialsOnRequestBody; - this.forceTokenTypeToCamelCase = params.forceTokenTypeToCamelCase; + this.formatAccessToken = params.formatAccessToken; } getAuthHeaderValue(): string { @@ -133,10 +133,11 @@ export class LhispOauthClient { } getAuthToken() { - const tokenType = this.forceTokenTypeToCamelCase - ? `${this.accessToken?.token_type?.[0]?.toUpperCase()}${this.accessToken?.token_type?.substring(1)}` - : this.accessToken?.token_type; - return `${tokenType} ${this.accessToken?.access_token}`; + if (this.formatAccessToken) { + return this.formatAccessToken(this.accessToken); + } + + return `${this.accessToken?.token_type} ${this.accessToken?.access_token}`; } async executarRequest({ From 0ac399073ea3e71f9e89cfd5286e79839387e8d5 Mon Sep 17 00:00:00 2001 From: bitbucket-pipelines Date: Thu, 9 Nov 2023 15:18:11 +0000 Subject: [PATCH 4/4] [skip CI] Version 1.0.23 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 10a30d0..5cffcfc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "lhisp-oauth-client", - "version": "1.0.22", + "version": "1.0.23", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "lhisp-oauth-client", - "version": "1.0.22", + "version": "1.0.23", "license": "MIT", "dependencies": { "axios": "^1.6.1", diff --git a/package.json b/package.json index 369e046..37aca59 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "lhisp-oauth-client", - "version": "1.0.22", + "version": "1.0.23", "main": "src/index", "types": "src/index.d.ts", "repository": "git@bitbucket.org:leandro_costa/lhisp-oauth-client.git",