Example #1
0
        protected override void RequestStartup(TinyIoCContainer requestContainer, IPipelines pipelines)
        {
            // At request startup we modify the request pipelines to
            // include forms authentication - passing in our now request
            // scoped user name mapper.
            //
            // The pipelines passed in here are specific to this request,
            // so we can add/remove/update items in them as we please.

            CryptographyConfiguration cryptoConfig = new CryptographyConfiguration(
                new RijndaelEncryptionProvider(new DokukuKeyGenerator()),
                new DefaultHmacProvider(new DokukuKeyGenerator()));

            var formsAuthConfiguration =
                new FormsAuthenticationConfiguration(cryptoConfig)
            {
                RedirectUrl = System.Configuration.ConfigurationManager.AppSettings["LoginUrl"],
                UserMapper  = requestContainer.Resolve <IUserMapper>(),
            };

            FormsAuthentication.Enable(pipelines, formsAuthConfiguration);
            Jsonp.Enable(pipelines);
            pipelines.AfterRequest.AddItemToEndOfPipeline(SetCookieDomain);
            requestContainer.Register <RazorViewEngine>();
        }
Example #2
0
 public void SerializeToStream()
 {
     using (var stream = new MemoryStream())
     {
         Jsonp.Serialize(stream, _callback, _object);
         GetString(stream.ToArray()).Is(_expected);
     }
 }
Example #3
0
        public async Task SerializeAsync()
        {
            using (var stream = new MemoryStream())
            {
                await Jsonp.SerializeAsync(stream, _callback, _object);

                GetString(stream.ToArray()).Is(_expected);
            }
        }
Example #4
0
 public void Serialize()
 {
     GetString(Jsonp.Serialize(_callback, _object)).Is(_expected);
 }