Мне нужно иметь проверку подлинности Windows и аутентификацию owin (forms), но я не могу заставить ее работать.
Вероятно, лучшим вариантом является наличие двух сайтов, которые имеют разные методы проверки подлинности.
Я нашел проект, который делает то, что я хочу: MVC5-MixedAuth. Но он использует IISExpress, и я не могу заставить его работать с локальным IIS.
Произошла ошибка:
Фильтрация запросов настроена на веб-сервере для отклонения запроса, потому что строка запроса слишком длинная.
Если я удалю весь мой метод ConfigureAuth() внутри Startup.Auth.cs, он не выдает ошибку, но я не могу войти, потому что это необходимо для CookieAuthentication.
Startup.Auth.cs:
public void ConfigureAuth(IAppBuilder app)
{
app.CreatePerOwinContext(dbEmployeePortal.Create);
app.CreatePerOwinContext<ApplicationUserManager>(ApplicationUserManager.Create);
app.CreatePerOwinContext<ApplicationSignInManager>(ApplicationSignInManager.Create);
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
LoginPath = new PathString("/Account/Login"),
Provider = new CookieAuthenticationProvider
{
OnValidateIdentity = SecurityStampValidator.OnValidateIdentity<ApplicationUserManager, UserMaster, int>
(
validateInterval: TimeSpan.FromMinutes(30),
regenerateIdentityCallback: (manager, user) => user.GenerateUserIdentityAsync(manager),
getUserIdCallback: (id) => (Int32.Parse(id.GetUserId()))
)
}
});
app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie);
app.UseTwoFactorSignInCookie(DefaultAuthenticationTypes.TwoFactorCookie, TimeSpan.FromMinutes(5));
app.UseTwoFactorRememberBrowserCookie(DefaultAuthenticationTypes.TwoFactorRememberBrowserCookie);
}
Любая идея?
ОБНОВЛЕНИЕ 1
Ошибка
Фильтрация запросов настроена на веб-сервере для отклонения запроса, потому что строка запроса слишком длинная.
появляется, потому что возникает цикл входа, когда он пытается добраться до страницы входа.