kreta/KretaWeb/App_Start/SecureCookieManager.cs
2024-03-13 00:33:46 +01:00

34 lines
1,009 B
C#

using Microsoft.Owin;
using Microsoft.Owin.Infrastructure;
namespace Kreta.Web.App_Start
{
public class SecureCookieManager : ICookieManager
{
private readonly ICookieManager _innerManager;
public SecureCookieManager() : this(new CookieManager())
{
}
public SecureCookieManager(ICookieManager innerManager)
{
_innerManager = innerManager;
}
public void AppendResponseCookie(IOwinContext context, string key, string value, CookieOptions options)
{
options.Secure = true;
_innerManager.AppendResponseCookie(context, key, value, options);
}
public void DeleteCookie(IOwinContext context, string key, CookieOptions options)
{
_innerManager.DeleteCookie(context, key, options);
}
public string GetRequestCookie(IOwinContext context, string key)
{
return _innerManager.GetRequestCookie(context, key);
}
}
}