File tree Expand file tree Collapse file tree
src/Helldivers-2-API/OpenApi Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -41,6 +41,30 @@ public void Process(DocumentProcessorContext context)
4141 property . OneOf . Clear ( ) ;
4242 }
4343 }
44+
45+ context . Document . SecurityDefinitions . Add ( Constants . CLIENT_HEADER_NAME , new OpenApiSecurityScheme
46+ {
47+ Type = OpenApiSecuritySchemeType . ApiKey ,
48+ In = OpenApiSecurityApiKeyLocation . Header ,
49+ Name = Constants . CLIENT_HEADER_NAME ,
50+ Description = "A unique name that identifies your client to the API."
51+ } ) ;
52+
53+ context . Document . SecurityDefinitions . Add ( Constants . CONTACT_HEADER_NAME , new OpenApiSecurityScheme
54+ {
55+ Type = OpenApiSecuritySchemeType . ApiKey ,
56+ In = OpenApiSecurityApiKeyLocation . Header ,
57+ Name = Constants . CONTACT_HEADER_NAME ,
58+ Description = "Contact information for the developer (e.g. an email address or URL)."
59+ } ) ;
60+
61+ context . Document . SecurityDefinitions . Add ( "Bearer" , new OpenApiSecurityScheme
62+ {
63+ Type = OpenApiSecuritySchemeType . Http ,
64+ Scheme = "bearer" ,
65+ BearerFormat = "JWT" ,
66+ Description = "A JWT bearer token for authenticated access."
67+ } ) ;
4468 }
4569}
4670#endif
Original file line number Diff line number Diff line change @@ -14,27 +14,12 @@ public class SuperHeadersProcessor : IOperationProcessor
1414 /// <inheritdoc />
1515 public bool Process ( OperationProcessorContext context )
1616 {
17- context . OperationDescription . Operation . Parameters . Add (
18- new OpenApiParameter
17+ context . OperationDescription . Operation . Security ??= [ ] ;
18+ context . OperationDescription . Operation . Security . Add (
19+ new OpenApiSecurityRequirement
1920 {
20- Name = Constants . CLIENT_HEADER_NAME ,
21- Kind = OpenApiParameterKind . Header ,
22- Type = NJsonSchema . JsonObjectType . String ,
23- IsRequired = true ,
24- Description = "The name of the header that identifies the client to the API." ,
25- Default = string . Empty
26- }
27- ) ;
28-
29- context . OperationDescription . Operation . Parameters . Add (
30- new OpenApiParameter
31- {
32- Name = Constants . CONTACT_HEADER_NAME ,
33- Kind = OpenApiParameterKind . Header ,
34- Type = NJsonSchema . JsonObjectType . String ,
35- IsRequired = true ,
36- Description = "The name of the header with developer contact information." ,
37- Default = string . Empty
21+ { Constants . CLIENT_HEADER_NAME , [ ] } ,
22+ { Constants . CONTACT_HEADER_NAME , [ ] }
3823 }
3924 ) ;
4025
You can’t perform that action at this time.
0 commit comments