mirror of
https://github.com/CannedNet/CannedNet.git
synced 2026-10-25 23:18:54 -07:00
this is a big one so check the commit description
- auto fill storefront db from json files - creating an account now automatically creates a doomroom room for that player - consumables - gift boxes - earnable rewards from games (tokens dont work, but rro specific items do) - purchasing items works - some notification work, doesnt fully work iirc
This commit is contained in:
@@ -106,5 +106,26 @@ public class JwtTokenService
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int? GetAccountIdFromContext(HttpContext context)
|
||||
{
|
||||
try
|
||||
{
|
||||
var authHeader = context.Request.Headers.Authorization.ToString();
|
||||
if (string.IsNullOrEmpty(authHeader) || !authHeader.StartsWith("Bearer ", StringComparison.OrdinalIgnoreCase))
|
||||
return null;
|
||||
|
||||
var token = authHeader.Substring("Bearer ".Length);
|
||||
var accountId = ValidateAndGetAccountId(token);
|
||||
|
||||
if (string.IsNullOrEmpty(accountId) || !int.TryParse(accountId, out var id))
|
||||
return null;
|
||||
|
||||
return id;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user