feat: expose method to delete sid
This commit is contained in:
parent
2a16c185fe
commit
9593979d7b
@ -27,6 +27,13 @@ public interface ISessionService
|
||||
/// <exception cref="ArgumentNullException"><paramref name="session" /> is <see langword="null" />.</exception>
|
||||
void DeleteSession(ISession session);
|
||||
|
||||
/// <summary>
|
||||
/// Deletes the client's session cookie.
|
||||
/// </summary>
|
||||
/// <param name="response">The response to edit.</param>
|
||||
/// <exception cref="ArgumentNullException"><paramref name="response" /> is <see langword="null" />.</exception>
|
||||
IActionResult DeleteSessionCookie(HttpResponse response);
|
||||
|
||||
/// <summary>
|
||||
/// Saves a session cookie to the client's browser.
|
||||
/// </summary>
|
||||
|
@ -70,6 +70,13 @@ internal sealed class SessionService : BackgroundService, ISessionService
|
||||
context.SaveChanges();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public IActionResult DeleteSessionCookie(HttpResponse response)
|
||||
{
|
||||
response.Cookies.Delete("sid");
|
||||
return new RedirectToPageResult("/Admin/Login");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void SaveSessionCookie(HttpResponse response, ISession session)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user