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>
|
/// <exception cref="ArgumentNullException"><paramref name="session" /> is <see langword="null" />.</exception>
|
||||||
void DeleteSession(ISession session);
|
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>
|
/// <summary>
|
||||||
/// Saves a session cookie to the client's browser.
|
/// Saves a session cookie to the client's browser.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -70,6 +70,13 @@ internal sealed class SessionService : BackgroundService, ISessionService
|
||||||
context.SaveChanges();
|
context.SaveChanges();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public IActionResult DeleteSessionCookie(HttpResponse response)
|
||||||
|
{
|
||||||
|
response.Cookies.Delete("sid");
|
||||||
|
return new RedirectToPageResult("/Admin/Login");
|
||||||
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public void SaveSessionCookie(HttpResponse response, ISession session)
|
public void SaveSessionCookie(HttpResponse response, ISession session)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue