Added client side functionality and created register page

This commit is contained in:
2024-07-14 16:42:32 +02:00
parent 01978d30ce
commit a164a3d282
41 changed files with 1024 additions and 30 deletions

View File

@@ -28,7 +28,7 @@ public class HopFrameAuthentication<TDbContext>(
public static readonly TimeSpan RefreshTokenTime = new(30, 0, 0, 0);
protected override async Task<AuthenticateResult> HandleAuthenticateAsync() {
var accessToken = Request.Headers["Authorization"].ToString();
var accessToken = Request.Cookies[ITokenContext.AccessTokenType];
if (string.IsNullOrEmpty(accessToken)) return AuthenticateResult.Fail("No Access Token provided");
var tokenEntry = await context.Tokens.SingleOrDefaultAsync(token => token.Token == accessToken);
@@ -36,7 +36,7 @@ public class HopFrameAuthentication<TDbContext>(
if (tokenEntry is null) return AuthenticateResult.Fail("The provided Access Token does not exist");
if (tokenEntry.CreatedAt + AccessTokenTime < DateTime.Now) return AuthenticateResult.Fail("The provided Access Token is expired");
if (!(await context.Users.AnyAsync(user => user.Id == tokenEntry.UserId)))
if (!await context.Users.AnyAsync(user => user.Id == tokenEntry.UserId))
return AuthenticateResult.Fail("The provided Access Token does not match any user");
var claims = new List<Claim> {