- Notifications
You must be signed in to change notification settings - Fork6.1k
Support HTTP BasicAuth for authentication with auth-user argument, password or hashedPassword#7173
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:main
Are you sure you want to change the base?
Changes from1 commit
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
- Loading branch information
Uh oh!
There was an error while loading.Please reload this page.
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -140,8 +140,8 @@ export type Options<T> = { | ||
export const options: Options<Required<UserProvidedArgs>> = { | ||
auth: { type: AuthType, description: "The type of authentication to use." }, | ||
"auth-user": { | ||
type: "string", | ||
description: "The username for http-basic authentication.", | ||
}, | ||
password: { | ||
type: "string", | ||
@@ -486,6 +486,7 @@ export interface DefaultedArgs extends ConfigArgs { | ||
"proxy-domain": string[] | ||
verbose: boolean | ||
usingEnvPassword: boolean | ||
usingEnvAuthUser: boolean | ||
usingEnvHashedPassword: boolean | ||
"extensions-dir": string | ||
"user-data-dir": string | ||
@@ -575,9 +576,13 @@ export async function setDefaults(cliArgs: UserProvidedArgs, configArgs?: Config | ||
if (process.env.PASSWORD) { | ||
args.password = process.env.PASSWORD | ||
} | ||
const usingEnvAuthUser = !!process.env.AUTH_USER | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. If this variable isn't going to be used for another 50+ lines, I think it'd be better to inline it inside the return type | ||
if (process.env.AUTH_USER) { | ||
args["auth"] = AuthType.HttpBasic | ||
args["auth-user"] = process.env.AUTH_USER | ||
} else if (args["auth-user"]) { | ||
args["auth"] = AuthType.HttpBasic | ||
} | ||
if (process.env.CS_DISABLE_FILE_DOWNLOADS?.match(/^(1|true)$/)) { | ||
@@ -631,6 +636,7 @@ export async function setDefaults(cliArgs: UserProvidedArgs, configArgs?: Config | ||
return { | ||
...args, | ||
usingEnvPassword, | ||
usingEnvAuthUser, | ||
usingEnvHashedPassword, | ||
} as DefaultedArgs // TODO: Technically no guarantee this is fulfilled. | ||
} | ||
Uh oh!
There was an error while loading.Please reload this page.