feat: add support for Digest authorization (#4339)
Co-authored-by: jamesgeorge007 <25279263+jamesgeorge007@users.noreply.github.com> Co-authored-by: nivedin <nivedinp@gmail.com>
This commit is contained in:
@@ -17,7 +17,7 @@ export {
|
||||
|
||||
export { HoppGQLAuthAPIKey } from "./v/4"
|
||||
|
||||
export { GQLHeader } from "./v/6"
|
||||
export { GQLHeader, HoppGQLAuthAWSSignature } from "./v/6"
|
||||
export { HoppGQLAuth, HoppGQLAuthOAuth2 } from "./v/7"
|
||||
|
||||
export const GQL_REQ_SCHEMA_VERSION = 7
|
||||
|
||||
@@ -47,6 +47,7 @@ export {
|
||||
ClientCredentialsGrantTypeParams,
|
||||
HoppRESTAuth,
|
||||
HoppRESTAuthOAuth2,
|
||||
HoppRESTAuthDigest,
|
||||
PasswordGrantTypeParams,
|
||||
HoppRESTResponseOriginalRequest,
|
||||
HoppRESTRequestResponse,
|
||||
|
||||
@@ -49,6 +49,23 @@ export const HoppRESTAuthOAuth2 = z.object({
|
||||
|
||||
export type HoppRESTAuthOAuth2 = z.infer<typeof HoppRESTAuthOAuth2>
|
||||
|
||||
// in this new version, we add a new auth type for Digest authentication
|
||||
export const HoppRESTAuthDigest = z.object({
|
||||
authType: z.literal("digest"),
|
||||
username: z.string().catch(""),
|
||||
password: z.string().catch(""),
|
||||
realm: z.string().catch(""),
|
||||
nonce: z.string().catch(""),
|
||||
algorithm: z.enum(["MD5", "MD5-sess"]).catch("MD5"),
|
||||
qop: z.enum(["auth", "auth-int"]).catch("auth"),
|
||||
nc: z.string().catch(""),
|
||||
cnonce: z.string().catch(""),
|
||||
opaque: z.string().catch(""),
|
||||
disableRetry: z.boolean().catch(false),
|
||||
})
|
||||
|
||||
export type HoppRESTAuthDigest = z.infer<typeof HoppRESTAuthDigest>
|
||||
|
||||
export const HoppRESTAuth = z
|
||||
.discriminatedUnion("authType", [
|
||||
HoppRESTAuthNone,
|
||||
@@ -58,6 +75,7 @@ export const HoppRESTAuth = z
|
||||
HoppRESTAuthOAuth2,
|
||||
HoppRESTAuthAPIKey,
|
||||
HoppRESTAuthAWSSignature,
|
||||
HoppRESTAuthDigest,
|
||||
])
|
||||
.and(
|
||||
z.object({
|
||||
|
||||
Reference in New Issue
Block a user