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;
        }
예제 #2
0
파일: NancyHost.cs 프로젝트: nuxleus/Nancy
        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;
        }
예제 #3
0
 /// <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;
 }
예제 #4
0
 /// <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;
 }
예제 #5
0
 private static void ValidateCookie(INancyCookie cookie, string name, string value)
 {
     cookie.Name.ShouldEqual(name);
     cookie.Value.ShouldEqual(value);
 }
예제 #6
0
파일: Response.cs 프로젝트: pfgael/Nancy
 public Response AddCookie(INancyCookie nancyCookie)
 {
     Cookies.Add(nancyCookie);
     return this;
 }
예제 #7
0
 public CookieModel(INancyCookie cookie)
 {
     this.cookie = cookie;
 }
예제 #8
0
		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);
 }
예제 #10
0
 private static void ValidateCookie(INancyCookie cookie, string name, string value)
 {
     cookie.Name.ShouldEqual(name);
     cookie.Value.ShouldEqual(value);
 }
예제 #11
0
 public Response AddCookie(INancyCookie nancyCookie)
 {
     Cookies.Add(nancyCookie);
     return(this);
 }
예제 #12
0
 public CookieModel(INancyCookie cookie)
 {
     this.cookie = cookie;
 }
예제 #13
0
 /// <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);
 }