Skip to content

Commit

Permalink
Prevent IToken use-after-free in AuthenticationService
Browse files Browse the repository at this point in the history
  • Loading branch information
jvyden committed Oct 18, 2023
1 parent 4ee432a commit 6e10946
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Bunkum.Core/Services/AuthenticationService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,14 @@ public override void Initialize()
IToken<IUser>? token = this.AuthenticateToken(context, database);
if (token != null) return token.User;
}

return null;
}

/// <inheritdoc />
public override void AfterRequestHandled(ListenerContext context, Response response, MethodInfo method, Lazy<IDatabaseContext> database)
{
this._tokenCache.Value = null;
return null;
}

public IToken<IUser>? AuthenticateToken(ListenerContext context, Lazy<IDatabaseContext> database, bool remove = false)
Expand Down

0 comments on commit 6e10946

Please sign in to comment.