private DiagnosticsSession DecodeCookie(INancyCookie nancyCookie) { var cookieValue = nancyCookie.Value; var hmacStringLength = Base64Helpers.GetBase64Length(this.cryptoConfig.HmacProvider.HmacLength); var encryptedSession = cookieValue.Substring(hmacStringLength); var decrypted = this.cryptoConfig.EncryptionProvider.Decrypt(encryptedSession); return this.objectSerializer.Deserialize(decrypted) as DiagnosticsSession; }
private static Cookie ConvertCookie(INancyCookie nancyCookie) { var cookie = new Cookie(nancyCookie.Name, nancyCookie.Value, nancyCookie.Path, nancyCookie.Domain); if (nancyCookie.Expires.HasValue) { cookie.Expires = nancyCookie.Expires.Value; } return cookie; }
/// <summary> /// Adds a <see cref="INancyCookie"/> to the response. /// </summary> /// <param name="response">Response object</param> /// <param name="nancyCookie">A <see cref="INancyCookie"/> instance.</param> /// <returns></returns> public static Response WithCookie(this Response response, INancyCookie nancyCookie) { response.Cookies.Add(nancyCookie); return response; }
/// <summary> /// Add a cookie to the response. /// </summary> /// <param name="negotiator">The <see cref="Negotiator"/> instance.</param> /// <param name="cookie">The <see cref="INancyCookie"/> instance that should be added.</param> /// <returns>The modified <see cref="Negotiator"/> instance.</returns> public static Negotiator WithCookie(this Negotiator negotiator, INancyCookie cookie) { negotiator.NegotiationContext.Cookies.Add(cookie); return negotiator; }
private static void ValidateCookie(INancyCookie cookie, string name, string value) { cookie.Name.ShouldEqual(name); cookie.Value.ShouldEqual(value); }
public Response AddCookie(INancyCookie nancyCookie) { Cookies.Add(nancyCookie); return this; }
public CookieModel(INancyCookie cookie) { this.cookie = cookie; }
private static void ValidateCookie(INancyCookie cookie, string name, string value, DateTime? expires, string domain, string path) { cookie.Name.ShouldEqual(name); cookie.Value.ShouldEqual(value); cookie.Expires.ShouldEqual(expires); cookie.Domain.ShouldEqual(domain); cookie.Path.ShouldEqual(path); }
/// <summary> /// Add a cookie to the response. /// </summary> /// <param name="negotiator">The <see cref="Negotiator"/> instance.</param> /// <param name="cookie">The <see cref="INancyCookie"/> instance that should be added.</param> /// <returns>The modified <see cref="Negotiator"/> instance.</returns> public static Negotiator WithCookie(this Negotiator negotiator, INancyCookie cookie) { negotiator.NegotiationContext.Cookies.Add(cookie); return(negotiator); }
public Response AddCookie(INancyCookie nancyCookie) { Cookies.Add(nancyCookie); return(this); }
/// <summary> /// Adds a <see cref="INancyCookie"/> to the response. /// </summary> /// <param name="response">Response object</param> /// <param name="nancyCookie">A <see cref="INancyCookie"/> instance.</param> /// <returns></returns> public static Response WithCookie(this Response response, INancyCookie nancyCookie) { response.Cookies.Add(nancyCookie); return(response); }