@@ -98,15 +98,6 @@ public void StripUnknownCommands(CommandCollection commands)
98
98
public string ? ComputeHMAC ( string uri , CommandHandling handling )
99
99
=> this . ComputeHMAC ( new Uri ( uri , UriKind . RelativeOrAbsolute ) , handling ) ;
100
100
101
- /// <summary>
102
- /// Compute a Hash-based Message Authentication Code (HMAC) for request authentication.
103
- /// </summary>
104
- /// <param name="uri">The uri to compute the code from.</param>
105
- /// <param name="handling">The command collection handling.</param>
106
- /// <returns>The computed HMAC.</returns>
107
- public Task < string ? > ComputeHMACAsync ( string uri , CommandHandling handling )
108
- => this . ComputeHMACAsync ( new Uri ( uri , UriKind . RelativeOrAbsolute ) , handling ) ;
109
-
110
101
/// <summary>
111
102
/// Compute a Hash-based Message Authentication Code (HMAC) for request authentication.
112
103
/// </summary>
@@ -124,23 +115,6 @@ public void StripUnknownCommands(CommandCollection commands)
124
115
return this . ComputeHMAC ( host , path , queryString , handling ) ;
125
116
}
126
117
127
- /// <summary>
128
- /// Compute a Hash-based Message Authentication Code (HMAC) for request authentication.
129
- /// </summary>
130
- /// <param name="uri">The uri to compute the code from.</param>
131
- /// <param name="handling">The command collection handling.</param>
132
- /// <returns>The computed HMAC.</returns>
133
- public Task < string ? > ComputeHMACAsync ( Uri uri , CommandHandling handling )
134
- {
135
- ToComponents (
136
- uri ,
137
- out HostString host ,
138
- out PathString path ,
139
- out QueryString queryString ) ;
140
-
141
- return this . ComputeHMACAsync ( host , path , queryString , handling ) ;
142
- }
143
-
144
118
/// <summary>
145
119
/// Compute a Hash-based Message Authentication Code (HMAC) for request authentication.
146
120
/// </summary>
@@ -152,17 +126,6 @@ public void StripUnknownCommands(CommandCollection commands)
152
126
public string ? ComputeHMAC ( HostString host , PathString path , QueryString queryString , CommandHandling handling )
153
127
=> this . ComputeHMAC ( host , path , queryString , new ( QueryHelpers . ParseQuery ( queryString . Value ) ) , handling ) ;
154
128
155
- /// <summary>
156
- /// Compute a Hash-based Message Authentication Code (HMAC) for request authentication.
157
- /// </summary>
158
- /// <param name="host">The host header.</param>
159
- /// <param name="path">The path or pathbase.</param>
160
- /// <param name="queryString">The querystring.</param>
161
- /// <param name="handling">The command collection handling.</param>
162
- /// <returns>The computed HMAC.</returns>
163
- public Task < string ? > ComputeHMACAsync ( HostString host , PathString path , QueryString queryString , CommandHandling handling )
164
- => this . ComputeHMACAsync ( host , path , queryString , new ( QueryHelpers . ParseQuery ( queryString . Value ) ) , handling ) ;
165
-
166
129
/// <summary>
167
130
/// Compute a Hash-based Message Authentication Code (HMAC) for request authentication.
168
131
/// </summary>
@@ -175,34 +138,13 @@ public void StripUnknownCommands(CommandCollection commands)
175
138
public string ? ComputeHMAC ( HostString host , PathString path , QueryString queryString , QueryCollection query , CommandHandling handling )
176
139
=> this . ComputeHMAC ( this . ToHttpContext ( host , path , queryString , query ) , handling ) ;
177
140
178
- /// <summary>
179
- /// Compute a Hash-based Message Authentication Code (HMAC) for request authentication.
180
- /// </summary>
181
- /// <param name="host">The host header.</param>
182
- /// <param name="path">The path or pathbase.</param>
183
- /// <param name="queryString">The querystring.</param>
184
- /// <param name="query">The query collection.</param>
185
- /// <param name="handling">The command collection handling.</param>
186
- /// <returns>The computed HMAC.</returns>
187
- public Task < string ? > ComputeHMACAsync ( HostString host , PathString path , QueryString queryString , QueryCollection query , CommandHandling handling )
188
- => this . ComputeHMACAsync ( this . ToHttpContext ( host , path , queryString , query ) , handling ) ;
189
-
190
141
/// <summary>
191
142
/// Compute a Hash-based Message Authentication Code (HMAC) for request authentication.
192
143
/// </summary>
193
144
/// <param name="context">The request HTTP context.</param>
194
145
/// <param name="handling">The command collection handling.</param>
195
146
/// <returns>The computed HMAC.</returns>
196
147
public string ? ComputeHMAC ( HttpContext context , CommandHandling handling )
197
- => AsyncHelper . RunSync ( ( ) => this . ComputeHMACAsync ( context , handling ) ) ;
198
-
199
- /// <summary>
200
- /// Compute a Hash-based Message Authentication Code (HMAC) for request authentication.
201
- /// </summary>
202
- /// <param name="context">The request HTTP context.</param>
203
- /// <param name="handling">The command collection handling.</param>
204
- /// <returns>The computed HMAC.</returns>
205
- public async Task < string ? > ComputeHMACAsync ( HttpContext context , CommandHandling handling )
206
148
{
207
149
byte [ ] secret = this . options . HMACSecretKey ;
208
150
if ( secret is null || secret . Length == 0 )
@@ -222,7 +164,7 @@ public void StripUnknownCommands(CommandCollection commands)
222
164
}
223
165
224
166
ImageCommandContext imageCommandContext = new ( context , commands , this . commandParser , this . parserCulture ) ;
225
- return await this . options . OnComputeHMACAsync ( imageCommandContext , secret ) ;
167
+ return this . options . OnComputeHMAC ( imageCommandContext , secret ) ;
226
168
}
227
169
228
170
/// <summary>
@@ -234,14 +176,14 @@ public void StripUnknownCommands(CommandCollection commands)
234
176
/// </remarks>
235
177
/// <param name="context">Contains information about the current image request and parsed commands.</param>
236
178
/// <returns>The computed HMAC.</returns>
237
- internal async Task < string ? > ComputeHMACAsync ( ImageCommandContext context )
179
+ internal string ? ComputeHMAC ( ImageCommandContext context )
238
180
{
239
181
if ( context . Commands . Count == 0 )
240
182
{
241
183
return null ;
242
184
}
243
185
244
- return await this . options . OnComputeHMACAsync ( context , this . options . HMACSecretKey ) ;
186
+ return this . options . OnComputeHMAC ( context , this . options . HMACSecretKey ) ;
245
187
}
246
188
247
189
private static void ToComponents (
0 commit comments