feat: access token generic para permitir customização

This commit is contained in:
Leandro Costa 2023-06-16 19:06:10 -03:00
parent 4b61c118ad
commit 477d9fc6a7
3 changed files with 46 additions and 52 deletions

View file

@ -1,45 +1,44 @@
import { AxiosRequestConfig } from "axios";
export interface Headers {
[name: string]: any;
[name: string]: any;
}
export interface LhispOauthClientConstructorParams {
authUrl: string;
apiUrl: string;
clientId: string;
clientSecret: string;
certificado?: string;
senhaCertificado?: string;
authScope?: string;
authHeaderName?: string;
tokenHeaderName?: string;
headers?: Headers;
grantType?: string;
authContentType?: ContentType;
sendAuthCredentialsOnRequestBody?: boolean;
debug?: boolean;
authUrl: string;
apiUrl: string;
clientId: string;
clientSecret: string;
certificado?: string;
senhaCertificado?: string;
authScope?: string;
authHeaderName?: string;
tokenHeaderName?: string;
headers?: Headers;
grantType?: string;
authContentType?: ContentType;
sendAuthCredentialsOnRequestBody?: boolean;
debug?: boolean;
}
export interface ExecutarRequestParams extends AxiosRequestConfig {
path: string;
contentType?: ContentType,
path: string;
contentType?: ContentType;
}
export interface AccessToken {
token_type: string;
access_token: string;
expires_in: number;
scope?: string;
created_at?: number;
token_type: string;
access_token: string;
expires_in: number;
scope?: string;
}
export enum ContentType {
APPLICATION_JSON='application/json',
APPLICATION_X_WWW_FORM_URLENCODED='application/x-www-form-urlencoded',
APPLICATION_JSON = "application/json",
APPLICATION_X_WWW_FORM_URLENCODED = "application/x-www-form-urlencoded",
}
export const defaultGrantType = 'client_credentials';
export const defaultGrantType = "client_credentials";
export const defaultAuthContentType = ContentType.APPLICATION_X_WWW_FORM_URLENCODED;
export const defaultAuthHeaderName = 'Authorization';
export const defaultTokenHeaderName = 'Authorization';
export const defaultAuthHeaderName = "Authorization";
export const defaultTokenHeaderName = "Authorization";