feat: enable / disable authorization

This commit is contained in:
liyasthomas
2021-08-12 13:56:11 +05:30
parent 971b35a252
commit b18f7af28f
12 changed files with 172 additions and 108 deletions

View File

@@ -1,9 +1,11 @@
export type HoppRESTAuthNone = {
authType: "none"
authActive: true
}
export type HoppRESTAuthBasic = {
authType: "basic"
authActive: true
username: string
password: string
@@ -11,6 +13,7 @@ export type HoppRESTAuthBasic = {
export type HoppRESTAuthBearer = {
authType: "bearer"
authActive: true
token: string
}

View File

@@ -115,11 +115,13 @@ export function parseOldAuth(x: any): HoppRESTAuth {
if (!x.auth || x.auth === "None")
return {
authType: "none",
authActive: true,
}
if (x.auth === "Basic Auth")
return {
authType: "basic",
authActive: true,
username: x.httpUser,
password: x.httpPassword,
}
@@ -127,8 +129,9 @@ export function parseOldAuth(x: any): HoppRESTAuth {
if (x.auth === "Bearer Token")
return {
authType: "bearer",
authActive: true,
token: x.bearerToken,
}
return { authType: "none" }
return { authType: "none", authActive: true }
}