lhisp-oauth-client 1.0.24 → 1.0.26
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.
package/package.json
CHANGED
|
@@ -15,8 +15,10 @@ export declare class LhispOauthClient<iAccessToken extends AccessToken = AccessT
|
|
|
15
15
|
protected senhaCertificado?: string;
|
|
16
16
|
protected authScope?: string;
|
|
17
17
|
protected headers?: AxiosHeaders;
|
|
18
|
+
protected authHeaders?: AxiosHeaders;
|
|
18
19
|
protected grantType?: string;
|
|
19
20
|
protected agent: https.Agent;
|
|
21
|
+
protected authData: Record<string, string>;
|
|
20
22
|
protected accessToken?: iAccessToken;
|
|
21
23
|
protected refreshToken?: iAccessToken;
|
|
22
24
|
protected tokenCreatedAt: number;
|
|
@@ -31,6 +31,7 @@ const lhisp_oauth_client_t_1 = require("./lhisp-oauth-client.t");
|
|
|
31
31
|
const lhisp_logger_1 = __importDefault(require("lhisp-logger"));
|
|
32
32
|
class LhispOauthClient {
|
|
33
33
|
constructor(params) {
|
|
34
|
+
this.authData = {};
|
|
34
35
|
this.tokenCreatedAt = 0;
|
|
35
36
|
this.tokenExpiresIn = 0;
|
|
36
37
|
if (params.certificado) {
|
|
@@ -47,6 +48,8 @@ class LhispOauthClient {
|
|
|
47
48
|
}
|
|
48
49
|
this.certificado = params.certificado;
|
|
49
50
|
this.headers = (params.headers ? params.headers : {});
|
|
51
|
+
this.authHeaders = (params.authHeaders ? params.authHeaders : {});
|
|
52
|
+
this.authData = params.authData || {};
|
|
50
53
|
this.apiUrl = params.apiUrl;
|
|
51
54
|
this.authUrl = params.authUrl;
|
|
52
55
|
this.authScope = params.authScope;
|
|
@@ -94,11 +97,8 @@ class LhispOauthClient {
|
|
|
94
97
|
method: "POST",
|
|
95
98
|
url: this.authUrl,
|
|
96
99
|
httpsAgent: this.agent,
|
|
97
|
-
headers: {
|
|
98
|
-
|
|
99
|
-
"Content-Type": this.authContentType,
|
|
100
|
-
},
|
|
101
|
-
data: {},
|
|
100
|
+
headers: Object.assign({ [this.authHeaderName]: this.getAuthHeaderValue(), "Content-Type": this.authContentType }, this.authHeaders),
|
|
101
|
+
data: Object.assign({}, this.authData),
|
|
102
102
|
};
|
|
103
103
|
if (this.grantType)
|
|
104
104
|
authRequestOpt.data.grant_type = this.grantType;
|
|
@@ -14,8 +14,10 @@ export interface LhispOauthClientConstructorParams {
|
|
|
14
14
|
authHeaderName?: string;
|
|
15
15
|
tokenHeaderName?: string;
|
|
16
16
|
headers?: Headers;
|
|
17
|
+
authHeaders?: Headers;
|
|
17
18
|
grantType?: string;
|
|
18
19
|
authContentType?: ContentType;
|
|
20
|
+
authData?: Record<string, string>;
|
|
19
21
|
sendAuthCredentialsOnRequestBody?: boolean;
|
|
20
22
|
formatAccessToken?: (accessToken?: AccessToken) => string;
|
|
21
23
|
debug?: boolean;
|