2021-02-16 12:28:03 +00:00
|
|
|
import { Property } from "entities/Action";
|
|
|
|
|
|
|
|
|
|
export enum AuthType {
|
|
|
|
|
NONE = "NONE",
|
|
|
|
|
OAuth2 = "oAuth2",
|
2021-05-07 11:54:05 +00:00
|
|
|
basic = "basic",
|
2021-02-16 12:28:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export enum GrantType {
|
|
|
|
|
ClientCredentials = "client_credentials",
|
|
|
|
|
AuthorizationCode = "authorization_code",
|
|
|
|
|
}
|
|
|
|
|
|
2021-05-07 11:54:05 +00:00
|
|
|
export type Authentication = ClientCredentials | AuthorizationCode | Basic;
|
2021-02-16 12:28:03 +00:00
|
|
|
export interface ApiDatasourceForm {
|
|
|
|
|
datasourceId: string;
|
|
|
|
|
pluginId: string;
|
|
|
|
|
organizationId: string;
|
|
|
|
|
isValid: boolean;
|
|
|
|
|
url: string;
|
|
|
|
|
headers?: Property[];
|
|
|
|
|
isSendSessionEnabled: boolean;
|
|
|
|
|
sessionSignatureKey: string;
|
|
|
|
|
authType: AuthType;
|
|
|
|
|
authentication?: Authentication;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface Oauth2Common {
|
|
|
|
|
authenticationType: AuthType.OAuth2;
|
|
|
|
|
accessTokenUrl: string;
|
|
|
|
|
clientId: string;
|
|
|
|
|
clientSecret: string;
|
|
|
|
|
headerPrefix: string;
|
|
|
|
|
scopeString: string;
|
|
|
|
|
isTokenHeader: boolean;
|
2021-05-27 16:23:59 +00:00
|
|
|
audience: string;
|
|
|
|
|
resource: string;
|
2021-02-16 12:28:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface ClientCredentials extends Oauth2Common {
|
|
|
|
|
grantType: GrantType.ClientCredentials;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface AuthorizationCode extends Oauth2Common {
|
|
|
|
|
grantType: GrantType.AuthorizationCode;
|
|
|
|
|
authorizationUrl: string;
|
|
|
|
|
customAuthenticationParameters: Property[];
|
|
|
|
|
isAuthorizationHeader: boolean;
|
|
|
|
|
isAuthorized: boolean;
|
|
|
|
|
}
|
2021-05-07 11:54:05 +00:00
|
|
|
|
|
|
|
|
export interface Basic {
|
|
|
|
|
authenticationType: AuthType.basic;
|
|
|
|
|
username: string;
|
|
|
|
|
password: string;
|
|
|
|
|
}
|