예제 #1
0
        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());
                }
            }
        }
예제 #2
0
        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());
                }
            }
        }
예제 #3
0
        void InitializeComponent() {
            _module1 = new SystemModule();
            _module2 = new SystemAspNetModule();
            _module3 = new SecurityTesterModule();
            _module4 = new SecurityTesterAspNetModule();
            _sqlConnection1 = new SqlConnection();
            _securityStrategyComplex1 = new SecurityStrategyComplex();
            _authenticationStandard1 = new AnonymousAuthenticationStandard();
            ((ISupportInitialize)(this)).BeginInit();
            // 
            // sqlConnection1
            // 
            _sqlConnection1.ConnectionString =
                @"Integrated Security=SSPI;Pooling=false;Data Source=.\SQLEXPRESS;Initial Catalog=SecurityTester";
            _sqlConnection1.FireInfoMessageEventOnUserErrors = false;
            // 
            // SecurityTesterAspNetApplication
            // 
            _securityStrategyComplex1.Authentication = _authenticationStandard1;
            _securityStrategyComplex1.RoleType = typeof(XpandRole);
            _securityStrategyComplex1.UserType = typeof(SecuritySystemUser);
            // 
            // authenticationStandard1
            // 
            _authenticationStandard1.LogonParametersType = typeof(AnonymousLogonParameters);
            ApplicationName = "SecurityTester";
            Connection = _sqlConnection1;
            Modules.Add(_module1);
            Modules.Add(_module2);
            Modules.Add(_module3);
            Modules.Add(_module4);
            Security = _securityStrategyComplex1;

            DatabaseVersionMismatch += SecurityTesterAspNetApplication_DatabaseVersionMismatch;
            ((ISupportInitialize)(this)).EndInit();
        }