Skip to content

Commit be070be

Browse files
authored
Support for alternate http auth mechanisms (#291)
Fixes #290
1 parent d4df86a commit be070be

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

openapi3/security_scheme.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ func (ss *SecurityScheme) Validate(c context.Context) error {
115115
switch scheme {
116116
case "bearer":
117117
hasBearerFormat = true
118-
case "basic":
118+
case "basic", "negotiate", "digest":
119119
default:
120120
return fmt.Errorf("Security scheme of type 'http' has invalid 'scheme' value '%s'", scheme)
121121
}

openapi3/security_scheme_test.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,26 @@ var securitySchemeExamples = []securitySchemeExample{
4646
`),
4747
valid: true,
4848
},
49+
{
50+
title: "Negotiate Authentication Sample",
51+
raw: []byte(`
52+
{
53+
"type": "http",
54+
"scheme": "negotiate"
55+
}
56+
`),
57+
valid: true,
58+
},
59+
{
60+
title: "Unknown http Authentication Sample",
61+
raw: []byte(`
62+
{
63+
"type": "http",
64+
"scheme": "notvalid"
65+
}
66+
`),
67+
valid: false,
68+
},
4969
{
5070
title: "API Key Sample",
5171
raw: []byte(`

0 commit comments

Comments
 (0)