You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs
+49-32Lines changed: 49 additions & 32 deletions
Original file line number
Diff line number
Diff line change
@@ -48,6 +48,11 @@ public HttpSigningConfiguration()
48
48
/// </summary>
49
49
publicstringKeyFilePath{get;set;}
50
50
51
+
/// <summary>
52
+
/// Specify the API key in the form of a string, either configure the KeyString property or configure the KeyFilePath property.
53
+
/// </summary>
54
+
publicstringKeyString{get;set;}
55
+
51
56
/// <summary>
52
57
/// Gets the key pass phrase for password protected key
53
58
/// </summary>
@@ -112,6 +117,17 @@ internal Dictionary<string, string> GetHttpSignedHeader(string basePath,string m
112
117
//the list of signed headers and a base64-encoded signature.
113
118
conststringHEADER_AUTHORIZATION="Authorization";
114
119
120
+
//Read the api key from the file
121
+
if(!string.IsNullOrEmpty(this.KeyFilePath))
122
+
{
123
+
this.KeyString=ReadApiKeyFromFile(KeyFilePath);
124
+
}
125
+
126
+
if(string.IsNullOrEmpty(KeyString))
127
+
{
128
+
thrownewException("No API key has been provided.");
Copy file name to clipboardExpand all lines: samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs
+49-32Lines changed: 49 additions & 32 deletions
Original file line number
Diff line number
Diff line change
@@ -48,6 +48,11 @@ public HttpSigningConfiguration()
48
48
/// </summary>
49
49
publicstringKeyFilePath{get;set;}
50
50
51
+
/// <summary>
52
+
/// Specify the API key in the form of a string, either configure the KeyString property or configure the KeyFilePath property.
53
+
/// </summary>
54
+
publicstringKeyString{get;set;}
55
+
51
56
/// <summary>
52
57
/// Gets the key pass phrase for password protected key
53
58
/// </summary>
@@ -112,6 +117,17 @@ internal Dictionary<string, string> GetHttpSignedHeader(string basePath,string m
112
117
//the list of signed headers and a base64-encoded signature.
113
118
conststringHEADER_AUTHORIZATION="Authorization";
114
119
120
+
//Read the api key from the file
121
+
if(!string.IsNullOrEmpty(this.KeyFilePath))
122
+
{
123
+
this.KeyString=ReadApiKeyFromFile(KeyFilePath);
124
+
}
125
+
126
+
if(string.IsNullOrEmpty(KeyString))
127
+
{
128
+
thrownewException("No API key has been provided.");
0 commit comments