public FormsAuthenticationFixture() { this.cryptographyConfiguration = new CryptographyConfiguration( new RijndaelEncryptionProvider(new PassphraseKeyGenerator("SuperSecretPass", new byte[] { 1, 2, 3, 4, 5, 6, 7, 8 }, 1000)), new DefaultHmacProvider(new PassphraseKeyGenerator("UberSuperSecure", new byte[] { 1, 2, 3, 4, 5, 6, 7, 8 }, 1000))); this.config = new FormsAuthenticationConfiguration() { CryptographyConfiguration = this.cryptographyConfiguration, RedirectUrl = "/login", UserMapper = A.Fake<IUserMapper>(), RequiresSSL = false }; this.secureConfig = new FormsAuthenticationConfiguration() { CryptographyConfiguration = this.cryptographyConfiguration, RedirectUrl = "/login", UserMapper = A.Fake<IUserMapper>(), RequiresSSL = true }; this.context = new NancyContext { Request = new Request( "GET", new Url { Scheme = "http", BasePath = "/testing", HostName = "test.com", Path = "test" }) }; this.userGuid = new Guid("3D97EB33-824A-4173-A2C1-633AC16C1010"); }
protected FeatureTestBase() { Bundler.Enable(false); BundleTable.Bundles.Clear(); _configuration = new Dictionary<string, object>(); Configure(_configuration); Config.GetValueFunc = key => { object value = null; if (!_configuration.TryGetValue(key, out value)) { throw new InvalidOperationException( string.Format("Test is missing configuration value for key {0}", key)); } return value; }; FormsConfig = new FormsAuthenticationConfiguration { RedirectUrl = "~/admin/login", UserMapper = new FormsAuthenticationUserMapper(Store.OpenSession) }; Serializer = new JsonNetSerializer(); Deserializer = new JsonNetBodyDeserializer(); _browser = CreateBrowser(); Admin = Install("admin"); }
public NancyFormsAuthMiddleware(Func <IDictionary <string, object>, Task> next, FormsAuthenticationConfiguration formsAuthenticationConfiguration, IClaimsPrincipalLookup claimsPrincipalLookup) { _next = next; _formsAuthenticationConfiguration = formsAuthenticationConfiguration; _claimsPrincipalLookup = claimsPrincipalLookup; }
public NancyAuthMiddleware(Func <IDictionary <string, object>, Task> next, FormsAuthenticationConfiguration formsAuthenticationConfiguration, IUserManager userManager) { _next = next; _formsAuthenticationConfiguration = formsAuthenticationConfiguration; _userManager = userManager; }
private string TicketCompatibilityMode(FormsAuthenticationConfiguration formsSection) { #if NET35 return("n/a"); #else return(formsSection.TicketCompatibilityMode.ToString()); #endif }
public static void Initialize() { if (initialized) { return; } lock (locker) { if (initialized) { return; } #if NET_2_0 AuthenticationSection section = (AuthenticationSection)WebConfigurationManager.GetSection(authConfigPath); FormsAuthenticationConfiguration config = section.Forms; cookieName = config.Name; timeout = (int)config.Timeout.TotalMinutes; cookiePath = config.Path; protection = config.Protection; requireSSL = config.RequireSSL; slidingExpiration = config.SlidingExpiration; cookie_domain = config.Domain; cookie_mode = config.Cookieless; cookies_supported = true; /* XXX ? */ default_url = MapUrl(config.DefaultUrl); enable_crossapp_redirects = config.EnableCrossAppRedirects; login_url = MapUrl(config.LoginUrl); #else HttpContext context = HttpContext.Current; AuthConfig authConfig = context.GetConfig(authConfigPath) as AuthConfig; if (authConfig != null) { cookieName = authConfig.CookieName; timeout = authConfig.Timeout; cookiePath = authConfig.CookiePath; protection = authConfig.Protection; #if NET_1_1 requireSSL = authConfig.RequireSSL; slidingExpiration = authConfig.SlidingExpiration; #endif } else { cookieName = ".MONOAUTH"; timeout = 30; cookiePath = "/"; protection = FormsProtectionEnum.All; #if NET_1_1 slidingExpiration = true; #endif } #endif initialized = true; } }
protected override void InitialiseInternal(TinyIoC.TinyIoCContainer container) { base.InitialiseInternal(container); var formsAuthConfiguration = new FormsAuthenticationConfiguration() { Passphrase = "SuperSecretPass", Salt = "AndVinegarCrisps", HmacPassphrase = "UberSuperSecure", RedirectUrl = "/authentication/login", UsernameMapper = container.Resolve <IUsernameMapper>(), }; FormsAuthentication.Enable(this, formsAuthConfiguration); BeforeRequest += ctx => { var rootPathProvider = container.Resolve <IRootPathProvider>(); var staticFileExtensions = new Dictionary <string, string> { { "jpg", "image/jpg" }, { "png", "image/png" }, { "gif", "image/gif" }, { "css", "text/css" }, { "js", "text/javascript" } }; var requestedExtension = Path.GetExtension(ctx.Request.Uri); if (!string.IsNullOrEmpty(requestedExtension)) { var extensionWithoutDot = requestedExtension.Substring(1); if (staticFileExtensions.Keys.Any(x => x.Equals(extensionWithoutDot, StringComparison.InvariantCultureIgnoreCase))) { var fileName = Path.GetFileName(ctx.Request.Uri); if (fileName == null) { return(null); } var filePath = Path.Combine(rootPathProvider.GetRootPath(), "content", fileName); return(!File.Exists(filePath) ? null : new StaticFileResponse(filePath, staticFileExtensions[extensionWithoutDot])); } } return(null); }; }
protected override void RequestStartup(TinyIoCContainer requestContainer, IPipelines pipelines, NancyContext context) { var formsAuthConfiguration = new FormsAuthenticationConfiguration { RedirectUrl = "/login", UserMapper = requestContainer.Resolve <IUserMapper>() }; FormsAuthentication.Enable(pipelines, formsAuthConfiguration); }
public void Get_OAUth_CallBack_with_access_token_should_sign_the_user_in() { //arrange var fixture = new Fixture(); var oauth_token = fixture.Create <string>(); var oauth_verifier = fixture.Create <string>(); var twitterUserId = fixture.Create <long>(); var twitterApi = A.Fake <ITwitterAuthenticatedClient>(); var twitterUserTracker = A.Fake <ITwitterUserTracker>(); A.CallTo( () => twitterApi.Authenticate( A <string> .That.Matches(x => x == oauth_token), A <string> .That.Matches(x => x == oauth_verifier))).Invokes( _ => { A.CallTo(() => twitterApi.UserId).Returns(twitterUserId); }) .Returns(twitterUserId); var bootstrapper = new TestBootstrapper( with => { with.Module <AuthModule>(); with.Dependency <ITwitterAuthenticatedClient>(twitterApi); with.Dependency <ITwitterUserTracker>(twitterUserTracker); with.RequestStartup((container, pipelines, __) => { var formsAuthConfiguration = new FormsAuthenticationConfiguration() { RedirectUrl = "~/Auth/SignIn", UserMapper = twitterUserTracker }; FormsAuthentication.Enable(pipelines, formsAuthConfiguration); }); }); var browser = new Browser(bootstrapper); //act var response = browser.Get("/auth/callback", req => { req.Query("oauth_token", oauth_token); req.Query("oauth_verifier", oauth_verifier); }); //assert response.ShouldHaveRedirectedTo("/"); A.CallTo(() => twitterUserTracker.Register(A <Guid> ._, twitterApi)).MustHaveHappened(Repeated.Exactly.Once); }
private void EnableFormAuth(IUnityContainer container, IPipelines pipelines) { var formsAuthConfiguration = new FormsAuthenticationConfiguration() { RedirectUrl = "~/", UserMapper = container.Resolve <IUserMapper>(), }; FormsAuthentication.Enable(pipelines, formsAuthConfiguration); }
public FormsAuthenticationConfigurationFixture() { this.config = new FormsAuthenticationConfiguration() { Passphrase = "SuperSecretPass", Salt = "AndVinegarCrisps", HmacPassphrase = "UberSuperSecure", RedirectUrl = "/login", UsernameMapper = A.Fake <IUsernameMapper>(), }; }
public FormsAuthenticationConfigurationFixture() { this.config = new FormsAuthenticationConfiguration() { Passphrase = "SuperSecretPass", Salt = "AndVinegarCrisps", HmacPassphrase = "UberSuperSecure", RedirectUrl = "/login", UsernameMapper = A.Fake<IUsernameMapper>(), }; }
protected override void RequestStartup(ILifetimeScope container, IPipelines pipelines) { var formsAuthConfiguration = new FormsAuthenticationConfiguration { RedirectUrl = "~/login", UserMapper = container.Resolve <IUserRepository>(), }; FormsAuthentication.Enable(pipelines, formsAuthConfiguration); }
private void SetupFormsAuthentication(IKernel container, IPipelines pipelines) { var formsAuthConfiguration = new FormsAuthenticationConfiguration { RedirectUrl = "~/account/login", UserMapper = container.Get <IUserMapper>() }; FormsAuthentication.Enable(pipelines, formsAuthConfiguration); }
protected override void RequestStartup(TinyIoCContainer container, IPipelines pipelines, NancyContext context) { base.RequestStartup(container, pipelines, context); var formsAuthConfiguration = new FormsAuthenticationConfiguration { RedirectUrl = "~/", UserMapper = container.Resolve <IUserMapper>(), }; FormsAuthentication.Enable(pipelines, formsAuthConfiguration); }
protected override void RequestStartup(ILifetimeScope container, IPipelines pipelines, NancyContext context) { var formsAuthConfiguration = new FormsAuthenticationConfiguration { RedirectUrl = "~/login", UserMapper = container.Resolve<IUserRepository>(), }; FormsAuthentication.Enable(pipelines, formsAuthConfiguration); }
protected override void RequestStartup(TinyIoC.TinyIoCContainer container, Nancy.Bootstrapper.IPipelines pipelines) { var formsAuthConfiguration = new FormsAuthenticationConfiguration { RedirectUrl = "~/login", UserMapper = container.Resolve <IUserMapper>(), }; FormsAuthentication.Enable(pipelines, formsAuthConfiguration); base.RequestStartup(container, pipelines); }
protected override void ApplicationStartup(TinyIoCContainer container, IPipelines pipelines) { base.ApplicationStartup(container, pipelines); var formsAuthConfiguration = new FormsAuthenticationConfiguration() { RedirectUrl = "~/login", UserMapper = container.Resolve <IUserMapper>() }; FormsAuthentication.Enable(pipelines, formsAuthConfiguration); }
protected override void RequestStartup(TinyIoCContainer container, IPipelines pipelines, NancyContext context) { base.RequestStartup(container, pipelines, context); //form authentication var formsAuthConfiguration = new FormsAuthenticationConfiguration { RedirectUrl = ConfigHelper.GetAppSettingByKey("logonUrl"), UserMapper = container.Resolve <IUserMapper>(), }; FormsAuthentication.Enable(pipelines, formsAuthConfiguration); }
protected override void RequestStartup(ILifetimeScope container, IPipelines pipelines, NancyContext context) { base.RequestStartup(container, pipelines, context); var formsAuthConfiguration = new FormsAuthenticationConfiguration() { RedirectUrl = "~/login", UserMapper = container.Resolve <IUserMapper>(), }; FormsAuthentication.Enable(pipelines, formsAuthConfiguration); CookieBasedSessions.Enable(pipelines); }
protected override void RequestStartup(ILifetimeScope container, IPipelines pipelines, NancyContext context) { base.RequestStartup(container, pipelines, context); var config = new FormsAuthenticationConfiguration { RedirectUrl = "~/login", UserMapper = container.Resolve <IUserMapper>() }; FormsAuthentication.Enable(pipelines, config); }
protected override void RequestStartup(TinyIoCContainer requestContainer, IPipelines pipelines, NancyContext context) { base.RequestStartup(requestContainer, pipelines, context); var config = new FormsAuthenticationConfiguration() { RedirectUrl = "~/login", UserMapper = requestContainer.Resolve <IUserMapper>(), CryptographyConfiguration = _cryptographyConfiguration }; FormsAuthentication.Enable(pipelines, config); }
protected override void InitialiseInternal(TinyIoC.TinyIoCContainer container) { base.InitialiseInternal(container); var formsAuthConfiguration = new FormsAuthenticationConfiguration() { RedirectUrl = "~/login", UserMapper = container.Resolve <IUserMapper>(), }; FormsAuthentication.Enable(this, formsAuthConfiguration); }
public FormsAuthenticationConfigurationFixture() { var cryptographyConfiguration = new CryptographyConfiguration( new RijndaelEncryptionProvider(new PassphraseKeyGenerator("SuperSecretPass", new byte[] { 1, 2, 3, 4, 5, 6, 7, 8 })), new DefaultHmacProvider(new PassphraseKeyGenerator("UberSuperSecure", new byte[] { 1, 2, 3, 4, 5, 6, 7, 8 }))); this.config = new FormsAuthenticationConfiguration() { CryptographyConfiguration = cryptographyConfiguration, RedirectUrl = "/login", UserMapper = A.Fake <IUserMapper>(), }; }
public FormsAuthenticationConfigurationFixture() { var cryptographyConfiguration = new CryptographyConfiguration( new RijndaelEncryptionProvider(new PassphraseKeyGenerator("SuperSecretPass", new byte[] { 1, 2, 3, 4, 5, 6, 7, 8 })), new DefaultHmacProvider(new PassphraseKeyGenerator("UberSuperSecure", new byte[] { 1, 2, 3, 4, 5, 6, 7, 8 }))); this.config = new FormsAuthenticationConfiguration() { CryptographyConfiguration = cryptographyConfiguration, RedirectUrl = "/login", UserMapper = A.Fake<IUserMapper>(), }; }
public void Initialize(IPipelines pipelines) { var formsAuthConfiguration = new FormsAuthenticationConfiguration() { RedirectUrl = "~/login", UserMapper = Global.Sessions }; FormsAuthentication.Enable(pipelines, formsAuthConfiguration); pipelines.OnError += HandleException; }
protected override void ApplicationStartup(TinyIoCContainer _container, IPipelines _pipelines) { CookieBasedSessions.Enable(_pipelines); Nancy.Security.Csrf.Enable(_pipelines); var formsAuthConfiguration = new FormsAuthenticationConfiguration() { RedirectUrl = "/login", UserMapper = _container.Resolve <IUserMapper>(), }; FormsAuthentication.Enable(_pipelines, formsAuthConfiguration); }
protected override void InitialiseInternal(IContainer container) { base.InitialiseInternal(container); var formsAuthConfiguration = new FormsAuthenticationConfiguration() { RedirectUrl = "~/login", UsernameMapper = container.GetInstance <IUsernameMapper>() }; FormsAuthentication.Enable(this, formsAuthConfiguration); }
// 每次请求都会触发,一个页面会触发多次 protected override void RequestStartup(TinyIoCContainer container, Nancy.Bootstrapper.IPipelines pipelines, NancyContext context) { base.RequestStartup(container, pipelines, context); // 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. var formsAuthConfiguration = new FormsAuthenticationConfiguration() { RedirectUrl = "~/account/logon", UserMapper = container.Resolve <IUserMapper>(), }; FormsAuthentication.Enable(pipelines, formsAuthConfiguration); //log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); //pipelines.OnError.AddItemToEndOfPipeline((ctx, exception) => { // Task tasks = new Task(() => { // log.Error(exception.Message); // }); // DefaultJsonSerializer serializer = new DefaultJsonSerializer(); // Response error = new JsonResponse(exception.Message, serializer); // error.StatusCode = HttpStatusCode.InternalServerError; // return error; //}); // Enabling sessions in Nancy CookieBasedSessions.Enable(pipelines); //放RequestStartup这里是每次请求时判断session,为了避免session过期,所以不放在ApplicationStartup pipelines.BeforeRequest += (ctx) => { var uid = ctx.Request.Session["TempUserId"]; var user = ctx.CurrentUser; if (user == null && uid == null) { //ctx.Request.Session["TempUserId"] = "temp-" + DateTime.Now.ToString("-yyyy-MM-dd-hh-mm-ss-fffff"); ctx.Request.Session["TempUserId"] = "temp-" + Guid.NewGuid().ToString(); } return(null); //return <null or a Response object>; }; }
public static void ConfigureFormsAuth(IKernel container, IPipelines pipelines) { var formsAuthConfig = new FormsAuthenticationConfiguration { CryptographyConfiguration = container.Get <CryptographyConfiguration>(), UserMapper = container.Get <IUserMapper>(), DisableRedirect = false, RedirectUrl = "/login" }; FormsAuthentication.FormsAuthenticationCookieName = FormsAuthCookieName; FormsAuthentication.Enable(pipelines, formsAuthConfig); pipelines.AfterRequest += EnsureSlidingExpiry; }
protected override void ApplicationStartup(TinyIoCContainer container, IPipelines pipelines) { StaticConfiguration.DisableErrorTraces = false; StaticConfiguration.EnableRequestTracing = true; CookieBasedSessions.Enable(pipelines); var formsAuthConfiguration = new FormsAuthenticationConfiguration { RedirectUrl = "~/login", UserMapper = container.Resolve <IUserMapper>() }; FormsAuthentication.Enable(pipelines, formsAuthConfiguration); }
protected override void ApplicationStartup(ILifetimeScope container, IPipelines pipelines) { base.ApplicationStartup(container, pipelines); StaticConfiguration.DisableErrorTraces = false; var formsAuthConfig = new FormsAuthenticationConfiguration() { RedirectUrl = "~/login", UserMapper = container.Resolve <IUserMapper>(), }; FormsAuthentication.Enable(pipelines, formsAuthConfig); }
protected override void RequestStartup(Nancy.TinyIoc.TinyIoCContainer container, Nancy.Bootstrapper.IPipelines pipelines, Nancy.NancyContext context) { base.RequestStartup(container, pipelines, context); var formsAuthConfiguration = new FormsAuthenticationConfiguration { RedirectUrl = "~/login", UserMapper = new UserMapper(), RequiresSSL = true, DisableRedirect = (context.Request.Headers.Keys.Contains("Client") && context.Request.Headers["Client"].Contains("RichClient")) || context.Request.Url.Path.Contains("/login") }; FormsAuthentication.Enable(pipelines, formsAuthConfiguration); }
public static void Initialize() { if (initialized) { return; } lock (locker) { if (initialized) { return; } AuthenticationSection section = (AuthenticationSection)WebConfigurationManager.GetSection(authConfigPath); FormsAuthenticationConfiguration config = section.Forms; cookieName = config.Name; #if NET_4_0 Timeout = config.Timeout; #endif timeout = (int)config.Timeout.TotalMinutes; cookiePath = config.Path; protection = config.Protection; requireSSL = config.RequireSSL; slidingExpiration = config.SlidingExpiration; cookie_domain = config.Domain; cookie_mode = config.Cookieless; cookies_supported = true; /* XXX ? */ #if NET_4_0 if (!String.IsNullOrEmpty(default_url)) { default_url = MapUrl(default_url); } else #endif default_url = MapUrl(config.DefaultUrl); enable_crossapp_redirects = config.EnableCrossAppRedirects; #if NET_4_0 if (!String.IsNullOrEmpty(login_url)) { login_url = MapUrl(login_url); } else #endif login_url = MapUrl(config.LoginUrl); initialized = true; } }
// It test all existing (as of r61933) configuration // sections that use PropertyHelper.NonEmptyStringValidator. public void NullableStringProperties() { new AnonymousIdentificationSection().CookieName = null; new AnonymousIdentificationSection().CookiePath = null; new AssemblyInfo(null); new BufferModeSettings(null, 0x10000, 0x1000, 10, TimeSpan.FromMinutes(1), TimeSpan.FromSeconds(30), 10); new BuildProvider(null, null); new ClientTarget(null, null); new CodeSubDirectory(null); new EventMappingSettings(null, null); new ExpressionBuilder(null, null); FormsAuthenticationConfiguration fac = new FormsAuthenticationConfiguration(); // I don't like this test though. fac.DefaultUrl = null; fac.LoginUrl = null; fac.Name = null; fac.Path = null; new HttpHandlerAction(null, null, null); new HttpModuleAction(null, null); MachineKeySection mks = new MachineKeySection(); // algorithms are limited // mks.Decryption = null; mks.DecryptionKey = null; mks.ValidationKey = null; new MembershipSection().DefaultProvider = null; new NamespaceInfo(null); new OutputCacheProfile(null); new ProfileSettings(null); RoleManagerSection rms = new RoleManagerSection(); rms.CookieName = null; rms.CookiePath = null; rms.DefaultProvider = null; new RuleSettings(null, null, null); new SqlCacheDependencyDatabase(null, null); new TagMapInfo(null, null); new TagPrefixInfo(null, null, null, null, null); new TransformerInfo(null, null); new TrustLevel(null, null); new TrustSection().Level = null; new UrlMapping(null, null); // WebControlsSection.ClientScriptsLocation is not settable new WebPartsPersonalization().DefaultProvider = null; }
protected override void InitialiseInternal(TinyIoC.TinyIoCContainer container) { base.InitialiseInternal(container); var formsAuthConfiguration = new FormsAuthenticationConfiguration() { RedirectUrl = "~/login", UsernameMapper = container.Resolve<IUsernameMapper>(), }; FormsAuthentication.Enable(this, formsAuthConfiguration); //Adding a check on the pipeline to validate if the user is still authorised by facebook. this.BeforeRequest.AddItemToEndOfPipeline(FacebookAuthenticatedCheckPipeline.CheckUserIsNothAuthorisedByFacebookAnymore); }
protected override void ApplicationStartup(TinyIoCContainer container, IPipelines pipelines) { base.ApplicationStartup(container, pipelines); var cryptographyConfiguration = new CryptographyConfiguration( new RijndaelEncryptionProvider(new PassphraseKeyGenerator(Configuration.EncryptionKey, new byte[] { 8, 2, 10, 4, 68, 120, 7, 14 })), new DefaultHmacProvider(new PassphraseKeyGenerator(Configuration.HmacKey, new byte[] { 1, 20, 73, 49, 25, 106, 78, 86 }))); var authenticationConfiguration = new FormsAuthenticationConfiguration() { CryptographyConfiguration = cryptographyConfiguration, RedirectUrl = "/login", UserMapper = container.Resolve<IUserMapper>(), }; FormsAuthentication.Enable(pipelines, authenticationConfiguration); }
public FormsAuthenticationFixture() { this.config = new FormsAuthenticationConfiguration() { Passphrase = "SuperSecretPass", Salt = "AndVinegarCrisps", HmacPassphrase = "UberSuperSecure", RedirectUrl = "/login", UsernameMapper = A.Fake<IUsernameMapper>(), }; this.context = new NancyContext() { Request = new FakeRequest("GET", "/") }; this.userGuid = new Guid("3D97EB33-824A-4173-A2C1-633AC16C1010"); }
protected override void ApplicationStartup(TinyIoCContainer container, IPipelines pipelines) { base.ApplicationStartup(container, pipelines); var cryptographyConfiguration = new CryptographyConfiguration( new RijndaelEncryptionProvider(new PassphraseKeyGenerator("SuperSecretPass", new byte[] { 1, 2, 3, 4, 5, 6, 7, 8 })), new DefaultHmacProvider(new PassphraseKeyGenerator("UberSuperSecure", new byte[] { 1, 2, 3, 4, 5, 6, 7, 8 }))); var config = new FormsAuthenticationConfiguration() { CryptographyConfiguration = cryptographyConfiguration, RedirectUrl = "/login", UserMapper = container.Resolve<IUserMapper>(), }; FormsAuthentication.Enable(pipelines, config); }
protected void btnLogin_Click(object sender, EventArgs e) { UserHandler uh = new UserHandler(); if (uh.SetCurrentUserById(txtUserName.Text) == ErrorMessage.NOT_EXIST) lblMessage.Text="用户ID不存在"; else { if (txtPassword.Text != uh.currentUser.userPwd) lblMessage.Text = "密码错误"; else { Session["userId"] = uh.currentUser.userId; if (chkRemember.Checked) { FormsAuthenticationConfiguration conf = new FormsAuthenticationConfiguration(); TimeSpan old = conf.Timeout; conf.Timeout = System.TimeSpan.FromDays(30); if (uh.currentUser.userType == 1) { Response.Redirect("../Personal.aspx"); } else if (uh.currentUser.userType == 0) { Response.Redirect("NewsEdit.aspx"); } conf.Timeout = old; } else { if (uh.currentUser.userType == 1) { Response.Redirect("../Personal.aspx"); } else if (uh.currentUser.userType == 0) { Response.Redirect("NewsEdit.aspx"); } } } } }
public FormsAuthenticationFixture() { this.cryptographyConfiguration = new CryptographyConfiguration( new RijndaelEncryptionProvider(new PassphraseKeyGenerator("SuperSecretPass", new byte[] { 1, 2, 3, 4, 5, 6, 7, 8 }, 1000)), new DefaultHmacProvider(new PassphraseKeyGenerator("UberSuperSecure", new byte[] { 1, 2, 3, 4, 5, 6, 7, 8 }, 1000))); this.config = new FormsAuthenticationConfiguration() { CryptographyConfiguration = this.cryptographyConfiguration, RedirectUrl = "/login", UserMapper = A.Fake<IUserMapper>(), }; this.context = new NancyContext() { Request = new FakeRequest("GET", "/") }; this.userGuid = new Guid("3D97EB33-824A-4173-A2C1-633AC16C1010"); }