5
5
using System . Collections . Generic ;
6
6
using Microsoft . OpenApi . Extensions ;
7
7
using Microsoft . OpenApi . Interfaces ;
8
+ using Microsoft . OpenApi . Models . Interfaces ;
8
9
using Microsoft . OpenApi . Writers ;
9
10
10
11
namespace Microsoft . OpenApi . Models
11
12
{
12
13
/// <summary>
13
14
/// Security Scheme Object.
14
15
/// </summary>
15
- public class OpenApiSecurityScheme : IOpenApiReferenceable , IOpenApiExtensible
16
+ public class OpenApiSecurityScheme : IOpenApiExtensible , IOpenApiReferenceable , IOpenApiSecurityScheme
16
17
{
17
- /// <summary>
18
- /// REQUIRED. The type of the security scheme. Valid values are "apiKey", "http", "oauth2", "openIdConnect".
19
- /// </summary>
20
- public virtual SecuritySchemeType ? Type { get ; set ; }
21
-
22
- /// <summary>
23
- /// A short description for security scheme. CommonMark syntax MAY be used for rich text representation.
24
- /// </summary>
25
- public virtual string Description { get ; set ; }
26
-
27
- /// <summary>
28
- /// REQUIRED. The name of the header, query or cookie parameter to be used.
29
- /// </summary>
30
- public virtual string Name { get ; set ; }
18
+ /// <inheritdoc/>
19
+ public SecuritySchemeType ? Type { get ; set ; }
31
20
32
- /// <summary>
33
- /// REQUIRED. The location of the API key. Valid values are "query", "header" or "cookie".
34
- /// </summary>
35
- public virtual ParameterLocation ? In { get ; set ; }
21
+ /// <inheritdoc/>
22
+ public string Description { get ; set ; }
36
23
37
- /// <summary>
38
- /// REQUIRED. The name of the HTTP Authorization scheme to be used
39
- /// in the Authorization header as defined in RFC7235.
40
- /// </summary>
41
- public virtual string Scheme { get ; set ; }
24
+ /// <inheritdoc/>
25
+ public string Name { get ; set ; }
42
26
43
- /// <summary>
44
- /// A hint to the client to identify how the bearer token is formatted.
45
- /// Bearer tokens are usually generated by an authorization server,
46
- /// so this information is primarily for documentation purposes.
47
- /// </summary>
48
- public virtual string BearerFormat { get ; set ; }
27
+ /// <inheritdoc/>
28
+ public ParameterLocation ? In { get ; set ; }
49
29
50
- /// <summary>
51
- /// REQUIRED. An object containing configuration information for the flow types supported.
52
- /// </summary>
53
- public virtual OpenApiOAuthFlows Flows { get ; set ; }
30
+ /// <inheritdoc/>
31
+ public string Scheme { get ; set ; }
54
32
55
- /// <summary>
56
- /// REQUIRED. OpenId Connect URL to discover OAuth2 configuration values.
57
- /// </summary>
58
- public virtual Uri OpenIdConnectUrl { get ; set ; }
33
+ /// <inheritdoc/>
34
+ public string BearerFormat { get ; set ; }
59
35
60
- /// <summary>
61
- /// Specification Extensions.
62
- /// </summary>
63
- public virtual IDictionary < string , IOpenApiExtension > Extensions { get ; set ; } = new Dictionary < string , IOpenApiExtension > ( ) ;
36
+ /// <inheritdoc/>
37
+ public OpenApiOAuthFlows Flows { get ; set ; }
64
38
65
- /// <summary>
66
- /// Indicates if object is populated with data or is just a reference to the data
67
- /// </summary>
68
- public bool UnresolvedReference { get ; set ; }
39
+ /// <inheritdoc/>
40
+ public Uri OpenIdConnectUrl { get ; set ; }
69
41
70
- /// <summary>
71
- /// Reference object.
72
- /// </summary>
73
- public OpenApiReference Reference { get ; set ; }
42
+ /// <inheritdoc/>
43
+ public IDictionary < string , IOpenApiExtension > Extensions { get ; set ; } = new Dictionary < string , IOpenApiExtension > ( ) ;
74
44
75
45
/// <summary>
76
46
/// Parameterless constructor
77
47
/// </summary>
78
48
public OpenApiSecurityScheme ( ) { }
79
49
80
50
/// <summary>
81
- /// Initializes a copy of <see cref="OpenApiSecurityScheme "/> object
51
+ /// Initializes a copy of <see cref="IOpenApiSecurityScheme "/> object
82
52
/// </summary>
83
- public OpenApiSecurityScheme ( OpenApiSecurityScheme securityScheme )
53
+ public OpenApiSecurityScheme ( IOpenApiSecurityScheme securityScheme )
84
54
{
55
+ Utils . CheckArgumentNull ( securityScheme ) ;
85
56
Type = securityScheme ? . Type ;
86
57
Description = securityScheme ? . Description ?? Description ;
87
58
Name = securityScheme ? . Name ?? Name ;
@@ -91,27 +62,25 @@ public OpenApiSecurityScheme(OpenApiSecurityScheme securityScheme)
91
62
Flows = securityScheme ? . Flows != null ? new ( securityScheme ? . Flows ) : null ;
92
63
OpenIdConnectUrl = securityScheme ? . OpenIdConnectUrl != null ? new Uri ( securityScheme . OpenIdConnectUrl . OriginalString , UriKind . RelativeOrAbsolute ) : null ;
93
64
Extensions = securityScheme ? . Extensions != null ? new Dictionary < string , IOpenApiExtension > ( securityScheme . Extensions ) : null ;
94
- UnresolvedReference = securityScheme ? . UnresolvedReference ?? UnresolvedReference ;
95
- Reference = securityScheme ? . Reference != null ? new ( securityScheme ? . Reference ) : null ;
96
65
}
97
66
98
67
/// <summary>
99
68
/// Serialize <see cref="OpenApiSecurityScheme"/> to Open Api v3.1
100
69
/// </summary>
101
- public virtual void SerializeAsV31 ( IOpenApiWriter writer )
70
+ public void SerializeAsV31 ( IOpenApiWriter writer )
102
71
{
103
72
SerializeInternal ( writer , OpenApiSpecVersion . OpenApi3_1 , ( writer , element ) => element . SerializeAsV31 ( writer ) ) ;
104
73
}
105
74
106
75
/// <summary>
107
76
/// Serialize <see cref="OpenApiSecurityScheme"/> to Open Api v3.0
108
77
/// </summary>
109
- public virtual void SerializeAsV3 ( IOpenApiWriter writer )
78
+ public void SerializeAsV3 ( IOpenApiWriter writer )
110
79
{
111
80
SerializeInternal ( writer , OpenApiSpecVersion . OpenApi3_0 , ( writer , element ) => element . SerializeAsV3 ( writer ) ) ;
112
81
}
113
82
114
- internal virtual void SerializeInternal ( IOpenApiWriter writer , OpenApiSpecVersion version ,
83
+ private void SerializeInternal ( IOpenApiWriter writer , OpenApiSpecVersion version ,
115
84
Action < IOpenApiWriter , IOpenApiSerializable > callback )
116
85
{
117
86
Utils . CheckArgumentNull ( writer ) ;
@@ -161,7 +130,7 @@ internal virtual void SerializeInternal(IOpenApiWriter writer, OpenApiSpecVersio
161
130
/// <summary>
162
131
/// Serialize <see cref="OpenApiSecurityScheme"/> to Open Api v2.0
163
132
/// </summary>
164
- public virtual void SerializeAsV2 ( IOpenApiWriter writer )
133
+ public void SerializeAsV2 ( IOpenApiWriter writer )
165
134
{
166
135
Utils . CheckArgumentNull ( writer ) ;
167
136
0 commit comments