Skip to content

Commit 7b2821e

Browse files
committed
Add enums to cater for multiple scheme and bearer formats
1 parent 2937f02 commit 7b2821e

File tree

3 files changed

+52
-3
lines changed

3 files changed

+52
-3
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT license.
3+
4+
using Microsoft.OpenApi.Attributes;
5+
6+
namespace Microsoft.OpenApi.Models
7+
{
8+
/// <summary>
9+
/// The type of HTTP authentication schemes
10+
/// </summary>
11+
public enum AuthenticationScheme
12+
{
13+
/// <summary>
14+
/// Use basic HTTP authentication schemes
15+
/// </summary>
16+
[Display("basic")] Basic,
17+
18+
/// <summary>
19+
/// Use bearer Authentication scheme
20+
/// </summary>
21+
[Display("bearer")] Bearer,
22+
23+
/// <summary>
24+
/// Use OpenIdConnectUrl
25+
/// </summary>
26+
[Display("openIdConnectUrl")] OpenIdConnectUrl
27+
28+
29+
}
30+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT license.
3+
4+
using Microsoft.OpenApi.Attributes;
5+
6+
namespace Microsoft.OpenApi.Models
7+
{
8+
/// <summary>
9+
/// The type of Bearer authentication scheme
10+
/// </summary>
11+
public enum BearerFormat
12+
{
13+
/// <summary>
14+
/// Use JWT bearer format
15+
/// </summary>
16+
[Display("jwt")] JWT,
17+
18+
}
19+
}

src/Microsoft.OpenApi/Models/OpenApiSecurityScheme.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) Microsoft Corporation. All rights reserved.
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
22
// Licensed under the MIT license.
33

44
using System;
@@ -39,14 +39,14 @@ public class OpenApiSecurityScheme : IOpenApiSerializable, IOpenApiReferenceable
3939
/// REQUIRED. The name of the HTTP Authorization scheme to be used
4040
/// in the Authorization header as defined in RFC7235.
4141
/// </summary>
42-
public string Scheme { get; set; }
42+
public AuthenticationScheme Scheme { get; set; }
4343

4444
/// <summary>
4545
/// A hint to the client to identify how the bearer token is formatted.
4646
/// Bearer tokens are usually generated by an authorization server,
4747
/// so this information is primarily for documentation purposes.
4848
/// </summary>
49-
public string BearerFormat { get; set; }
49+
public BearerFormat BearerFormat { get; set; }
5050

5151
/// <summary>
5252
/// REQUIRED. An object containing configuration information for the flow types supported.

0 commit comments

Comments
 (0)