fixes for server auth
This commit is contained in:
@@ -15,5 +15,5 @@ public class ControllerBase : Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected string MareUser => HttpContext.User.Claims.First(f => string.Equals(f.Type, MareClaimTypes.Uid, StringComparison.Ordinal)).Value;
|
protected string MareUser => HttpContext.User.Claims.First(f => string.Equals(f.Type, MareClaimTypes.Uid, StringComparison.Ordinal)).Value;
|
||||||
protected string Authorization => "Bearer " + _generator.Token;
|
protected string Authorization => _generator.Token;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ public class RequestController : ControllerBase
|
|||||||
{
|
{
|
||||||
foreach (var file in files)
|
foreach (var file in files)
|
||||||
{
|
{
|
||||||
|
_logger.LogDebug("Prerequested file: " + file);
|
||||||
_cachedFileProvider.DownloadFileWhenRequired(file, Authorization);
|
_cachedFileProvider.DownloadFileWhenRequired(file, Authorization);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ public class CachedFileProvider
|
|||||||
_logger.LogInformation("Did not find {hash}, downloading from {server}", hash, downloadUrl);
|
_logger.LogInformation("Did not find {hash}, downloading from {server}", hash, downloadUrl);
|
||||||
|
|
||||||
using var requestMessage = new HttpRequestMessage(HttpMethod.Get, downloadUrl);
|
using var requestMessage = new HttpRequestMessage(HttpMethod.Get, downloadUrl);
|
||||||
requestMessage.Headers.Authorization = new AuthenticationHeaderValue(auth);
|
requestMessage.Headers.Authorization = new AuthenticationHeaderValue("Bearer", auth);
|
||||||
var response = await _httpClient.SendAsync(requestMessage).ConfigureAwait(false);
|
var response = await _httpClient.SendAsync(requestMessage).ConfigureAwait(false);
|
||||||
|
|
||||||
try
|
try
|
||||||
|
|||||||
Reference in New Issue
Block a user