Testing more garbage encryption
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
using SVSim.EmulatedEntrypoint.Constants;
|
||||
using SVSim.EmulatedEntrypoint.Security;
|
||||
using SVSim.EmulatedEntrypoint.Services;
|
||||
|
||||
namespace SVSim.EmulatedEntrypoint.Middlewares;
|
||||
|
||||
/// <summary>
|
||||
/// Maps an incoming request's session id to a udid if both are present.
|
||||
/// </summary>
|
||||
public class SessionidMappingMiddleware : IMiddleware
|
||||
{
|
||||
private readonly ShadowverseSessionService _shadowverseSessionService;
|
||||
|
||||
public SessionidMappingMiddleware(ShadowverseSessionService shadowverseSessionService)
|
||||
{
|
||||
_shadowverseSessionService = shadowverseSessionService;
|
||||
}
|
||||
|
||||
public async Task InvokeAsync(HttpContext context, RequestDelegate next)
|
||||
{
|
||||
bool hasSessionId = context.Request.Headers.TryGetValue(NetworkConstants.UdidHeaderName, out var udid);
|
||||
bool hasUdid = context.Request.Headers.TryGetValue(NetworkConstants.SessionIdHeaderName, out var sid);
|
||||
if (hasSessionId && hasUdid)
|
||||
{
|
||||
_shadowverseSessionService.StoreUdidForSessionId(sid.FirstOrDefault(), Guid.Parse(Encryption.Decode(udid.FirstOrDefault())));
|
||||
}
|
||||
|
||||
await next.Invoke(context);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user