feat: enable / disable authorization
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
@@ -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 }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user