Initial commit

This commit is contained in:
Leandro Costa 2023-01-26 18:33:18 -03:00
parent ec65720e99
commit 53c3fbffe6
8 changed files with 2604 additions and 0 deletions

View file

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