void ApplicationOnSetupComplete(object sender, EventArgs eventArgs) { var webApplication = ((WebApplication) sender); webApplication.SetupComplete -= ApplicationOnSetupComplete; _autoAthentication = ((IModelOptionsAuthentication)webApplication.Model.Options).Athentication.AutoAthentication; _anonymousAuthentication = ((IModelOptionsAuthentication) webApplication.Model.Options).Athentication.AnonymousAuthentication; if (_autoAthentication.UseOnlySecuredStorage) { webApplication.LastLogonParametersWriting += ApplicationOnLastLogonParametersWriting; } if (AutomaticallyLogonEnabled(webApplication)) { webApplication.CanAutomaticallyLogonWithStoredLogonParameters = true; ((IWriteSecuredLogonParameters)webApplication).CustomWriteSecuredLogonParameters += OnCustomWriteSecuredLogonParameters; } if (_anonymousAuthentication.Enabled) { var authentication = ((SecurityStrategyBase)webApplication.Security).Authentication; var anonymousAuthenticationStandard = authentication as AnonymousAuthenticationStandard; if (anonymousAuthenticationStandard == null) { authentication=new AnonymousAuthenticationStandard(authentication.UserType, typeof(AnonymousLogonParameters)); } ((SecurityStrategyBase)webApplication.Security).Authentication = authentication; var securityStrategyBase = (SecurityStrategyBase)webApplication.Security; var anomymousLogonParameters = securityStrategyBase.LogonParameters as AnonymousLogonParameters; if (anomymousLogonParameters == null) { securityStrategyBase.Authentication.SetLogonParameters(new AnonymousLogonParameters()); } } }
void ApplicationOnSetupComplete(object sender, EventArgs eventArgs) { var webApplication = ((WebApplication)sender); webApplication.SetupComplete -= ApplicationOnSetupComplete; _autoAthentication = ((IModelOptionsAuthentication)webApplication.Model.Options).Athentication.AutoAthentication; _anonymousAuthentication = ((IModelOptionsAuthentication)webApplication.Model.Options).Athentication.AnonymousAuthentication; if (_autoAthentication.UseOnlySecuredStorage) { webApplication.LastLogonParametersWriting += ApplicationOnLastLogonParametersWriting; } if (AutomaticallyLogonEnabled(webApplication)) { webApplication.CanAutomaticallyLogonWithStoredLogonParameters = true; ((IWriteSecuredLogonParameters)webApplication).CustomWriteSecuredLogonParameters += OnCustomWriteSecuredLogonParameters; } if (_anonymousAuthentication.Enabled) { var authentication = ((SecurityStrategyBase)webApplication.Security).Authentication; var anonymousAuthenticationStandard = authentication as AnonymousAuthenticationStandard; if (anonymousAuthenticationStandard == null) { authentication = new AnonymousAuthenticationStandard(authentication.UserType, typeof(AnonymousLogonParameters)); } ((SecurityStrategyBase)webApplication.Security).Authentication = authentication; var securityStrategyBase = (SecurityStrategyBase)webApplication.Security; var anomymousLogonParameters = securityStrategyBase.LogonParameters as AnonymousLogonParameters; if (anomymousLogonParameters == null) { securityStrategyBase.Authentication.SetLogonParameters(new AnonymousLogonParameters()); } } }
void ApplicationOnSetupComplete(object sender, EventArgs eventArgs) { var webApplication = ((WebApplication)sender); webApplication.SetupComplete -= ApplicationOnSetupComplete; _autoAthentication = ((IModelOptionsAuthentication)webApplication.Model.Options).Athentication.AutoAthentication; _anonymousAuthentication = ((IModelOptionsAuthentication)webApplication.Model.Options).Athentication.AnonymousAuthentication; if (_autoAthentication.UseOnlySecuredStorage) { webApplication.LastLogonParametersWriting += ApplicationOnLastLogonParametersWriting; } if (AutomaticallyLogonEnabled(webApplication)) { webApplication.CanAutomaticallyLogonWithStoredLogonParameters = true; ((IWriteSecuredLogonParameters)webApplication).CustomWriteSecuredLogonParameters += OnCustomWriteSecuredLogonParameters; } if (_anonymousAuthentication.Enabled) { var anomymousLogonParameters = webApplication.Security.LogonParameters as AnonymousLogonParameters; if (anomymousLogonParameters == null) { throw new NotImplementedException(webApplication.Security + " LogonParameter is not of type " + typeof(AnonymousLogonParameters)); } var anonymousAuthenticationStandard = ((SecurityStrategyBase)webApplication.Security).Authentication as AnonymousAuthenticationStandard; if (anonymousAuthenticationStandard == null) { throw new NotImplementedException("Seucirty authentication is not of type " + typeof(AnonymousAuthenticationStandard)); } } }
void ApplicationOnSetupComplete(object sender, EventArgs eventArgs) { var webApplication = ((WebApplication) sender); webApplication.SetupComplete -= ApplicationOnSetupComplete; _autoAthentication = ((IModelOptionsAuthentication)webApplication.Model.Options).Athentication.AutoAthentication; _anonymousAuthentication = ((IModelOptionsAuthentication) webApplication.Model.Options).Athentication.AnonymousAuthentication; if (_autoAthentication.UseOnlySecuredStorage) { webApplication.LastLogonParametersWriting += ApplicationOnLastLogonParametersWriting; } if (AutomaticallyLogonEnabled(webApplication)) { webApplication.CanAutomaticallyLogonWithStoredLogonParameters = true; ((IWriteSecuredLogonParameters)webApplication).CustomWriteSecuredLogonParameters += OnCustomWriteSecuredLogonParameters; } if (_anonymousAuthentication.Enabled) { var anomymousLogonParameters = webApplication.Security.LogonParameters as AnonymousLogonParameters; if (anomymousLogonParameters == null) { throw new NotImplementedException(webApplication.Security+" LogonParameter is not of type " +typeof(AnonymousLogonParameters)); } var anonymousAuthenticationStandard = ((SecurityStrategyBase) webApplication.Security).Authentication as AnonymousAuthenticationStandard; if (anonymousAuthenticationStandard == null) { throw new NotImplementedException("Seucirty authentication is not of type " + typeof(AnonymousAuthenticationStandard)); } } }
void ApplicationOnSetupComplete(object sender, EventArgs eventArgs) { var webApplication = ((WebApplication)sender); webApplication.SetupComplete -= ApplicationOnSetupComplete; _autoAthentication = ((IModelOptionsAuthentication)webApplication.Model.Options).Athentication.AutoAthentication; _anonymousAuthentication = ((IModelOptionsAuthentication)webApplication.Model.Options).Athentication.AnonymousAuthentication; if (_autoAthentication.UseOnlySecuredStorage) { webApplication.LastLogonParametersWriting += ApplicationOnLastLogonParametersWriting; } if (AutomaticallyLogonEnabled(webApplication)) { webApplication.CanAutomaticallyLogonWithStoredLogonParameters = true; webApplication.LoggedOn += WebApplicationOnLoggedOn; } if (_anonymousAuthentication.Enabled) { webApplication.CanAutomaticallyLogonWithStoredLogonParameters = true; var cookie = HttpContext.Current.Request.Cookies.Get(AnonymousLogonController.CookieName); Tracing.Tracer.LogText($"cookie={cookie}"); if (cookie == null) { var authenticationBase = ((SecurityStrategyBase)SecuritySystem.Instance).Authentication; authenticationBase.SetLogonParameters(new AuthenticationStandardLogonParameters(_anonymousAuthentication.AnonymousUser, null)); var httpCookie = HttpCookie(_anonymousAuthentication.AnonymousUser, false); HttpContext.Current.Response.Cookies.Add(httpCookie); AuthenticateThisRequest(); } else { webApplication.LoggedOn += (o, args) => { AnonymousLogonController.InvalidateAnonymousCookie(); }; } } }