From be070be7974bcc3661f1898837e4a91fbcb2c87f Mon Sep 17 00:00:00 2001 From: Jake Scott Date: Fri, 29 Jan 2021 02:37:44 -0500 Subject: [PATCH] Support for alternate http auth mechanisms (#291) Fixes #290 --- openapi3/security_scheme.go | 2 +- openapi3/security_scheme_test.go | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/openapi3/security_scheme.go b/openapi3/security_scheme.go index 7e8301987..8d6c7c1fb 100644 --- a/openapi3/security_scheme.go +++ b/openapi3/security_scheme.go @@ -115,7 +115,7 @@ func (ss *SecurityScheme) Validate(c context.Context) error { switch scheme { case "bearer": hasBearerFormat = true - case "basic": + case "basic", "negotiate", "digest": default: return fmt.Errorf("Security scheme of type 'http' has invalid 'scheme' value '%s'", scheme) } diff --git a/openapi3/security_scheme_test.go b/openapi3/security_scheme_test.go index 9edb17a75..cba0b8442 100644 --- a/openapi3/security_scheme_test.go +++ b/openapi3/security_scheme_test.go @@ -46,6 +46,26 @@ var securitySchemeExamples = []securitySchemeExample{ `), valid: true, }, + { + title: "Negotiate Authentication Sample", + raw: []byte(` +{ + "type": "http", + "scheme": "negotiate" +} +`), + valid: true, + }, + { + title: "Unknown http Authentication Sample", + raw: []byte(` +{ + "type": "http", + "scheme": "notvalid" +} +`), + valid: false, + }, { title: "API Key Sample", raw: []byte(`