Beispiel #1
0
        static void Main() {
            
#if EASYTEST
			DevExpress.ExpressApp.Win.EasyTest.EasyTestRemotingRegistration.Register();
#endif
            
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            EditModelPermission.AlwaysGranted = Debugger.IsAttached;
            var winApplication =new SecuritySystemExampleWindowsFormsApplication();
            try {
                winApplication.ConnectionString = "http://localhost:1451/DataServer";
                XpandWcfDataServerHelper.AddKnownTypes();
                var defaultBinding = (WSHttpBinding) WcfDataServerHelper.CreateDefaultBinding();
                defaultBinding.ReaderQuotas.MaxStringContentLength = 2147483647;
                var clientDataServer = new WcfSecuredDataServerClient(
                    defaultBinding,
                    new EndpointAddress(winApplication.ConnectionString));
                var securityClient =new ServerSecurityClient(clientDataServer, new ClientInfoFactory()){IsSupportChangePassword = true};
                winApplication.ApplicationName = "SecuritySystemExample";
                winApplication.Security = securityClient;
                winApplication.CreateCustomObjectSpaceProvider +=
                    delegate(object sender, CreateCustomObjectSpaceProviderEventArgs e) {
                        e.ObjectSpaceProvider =new DataServerObjectSpaceProvider(clientDataServer, securityClient);
                    };

                winApplication.Setup();
                winApplication.Start();
                clientDataServer.Close();
            }
            catch (Exception e) {
                winApplication.HandleException(e);
            }
        }
Beispiel #2
0
        static void Main() {
#if EASYTEST
			DevExpress.ExpressApp.Win.EasyTest.EasyTestRemotingRegistration.Register();
#endif
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            EditModelPermission.AlwaysGranted = Debugger.IsAttached;
            var winApplication =
                new SecuritySystemExampleWindowsFormsApplication();
            const string connectionString = "tcp://localhost:1426/DataServer";
            winApplication.ConnectionString = connectionString;
            try {
                var t = new Hashtable{{"secure", true}, {"tokenImpersonationLevel", "impersonation"}};
                var channel = new TcpChannel(t, null, null);
                ChannelServices.RegisterChannel(channel, true);
                var clientDataServer = (IDataServer) Activator.GetObject(
                    typeof (RemoteSecuredDataServer), connectionString);
                var securityClient =
                    new ServerSecurityClient(clientDataServer, new ClientInfoFactory()){IsSupportChangePassword = true};
                winApplication.ApplicationName = "SecuritySystemExample";
                winApplication.Security = securityClient;
                winApplication.CreateCustomObjectSpaceProvider +=
                    delegate(object sender, CreateCustomObjectSpaceProviderEventArgs e) {
                        e.ObjectSpaceProvider =
                            new DataServerObjectSpaceProvider(clientDataServer, securityClient);
                    };
                winApplication.Setup();
                winApplication.Start();
            }
            catch (Exception e) {
                winApplication.HandleException(e);
            }
        }
Beispiel #3
0
        static void Main()
        {
#if EASYTEST
            DevExpress.ExpressApp.Win.EasyTest.EasyTestRemotingRegistration.Register();
#endif
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            EditModelPermission.AlwaysGranted = System.Diagnostics.Debugger.IsAttached;
            if (Tracing.GetFileLocationFromSettings() == DevExpress.Persistent.Base.FileLocation.CurrentUserApplicationDataFolder)
            {
                Tracing.LocalUserAppDataPath = Application.LocalUserAppDataPath;
            }
            Tracing.Initialize();
            BPIWABKWindowsFormsApplication winApplication = new BPIWABKWindowsFormsApplication();
            // Refer to the https://documentation.devexpress.com/eXpressAppFramework/CustomDocument112680.aspx help article for more details on how to provide a custom splash form.
            //winApplication.SplashScreen = new DevExpress.ExpressApp.Win.Utils.DXSplashScreen("YourSplashImage.png");
            SecurityAdapterHelper.Enable();
            string connectionString = "tcp://localhost:8082/DataServer";
#if DEBUG
            connectionString = "tcp://127.0.0.1:8082/DataServer";
#endif
            try
            {
                Hashtable t = new Hashtable();
                t.Add("secure", true);
                t.Add("tokenImpersonationLevel", "impersonation");
                //t.Add("username", "ConsoleUser");
                //t.Add("password", "password");
                //if (string.IsNullOrEmpty(ConfigurationManager.AppSettings["Username"]) == false)
                //{
                //    t.Add("username", ConfigurationManager.AppSettings["Username"]);
                //}
                //if (string.IsNullOrEmpty(ConfigurationManager.AppSettings["Password"]) == false)
                //{
                //    t.Add("password", ConfigurationManager.AppSettings["Password"]);
                //}
                TcpChannel channel = new TcpChannel(t, null, null);
                ChannelServices.RegisterChannel(channel, true);
                IDataServer          clientDataServer = (IDataServer)Activator.GetObject(typeof(RemoteSecuredDataServer), connectionString);
                ServerSecurityClient securityClient   = new ServerSecurityClient(clientDataServer, new ClientInfoFactory());
                securityClient.SupportNavigationPermissionsForTypes = false;
                securityClient.IsSupportChangePassword = true;
                winApplication.Security = securityClient;
                winApplication.CreateCustomObjectSpaceProvider += delegate(object sender, CreateCustomObjectSpaceProviderEventArgs e)
                {
                    e.ObjectSpaceProvider = new DataServerObjectSpaceProvider(clientDataServer, securityClient);
                };
                winApplication.Setup();
                winApplication.Start();
            }
            catch (Exception e)
            {
                winApplication.HandleException(e);
            }
        }
Beispiel #4
0
        protected void Session_Start(Object sender, EventArgs e)
        {
            WebApplication.SetInstance(Session, new SecuritySystemExampleAspNetApplication());
            IDataServer          clientDataServer = (IDataServer)this.Application["DataServer"];
            ServerSecurityClient securityClient   = new ServerSecurityClient(
                clientDataServer, new ClientInfoFactory());

            securityClient.IsSupportChangePassword  = true;
            WebApplication.Instance.ApplicationName = "SecuritySystemExample";
            WebApplication.Instance.Security        = securityClient;
            WebApplication.Instance.CreateCustomObjectSpaceProvider +=
                delegate(object _sender, CreateCustomObjectSpaceProviderEventArgs args) {
                args.ObjectSpaceProvider = new DataServerObjectSpaceProvider(clientDataServer, securityClient);
            };
            WebApplication.Instance.Setup();
            WebApplication.Instance.Start();
        }
Beispiel #5
0
        static void Main()
        {
#if EASYTEST
            DevExpress.ExpressApp.Win.EasyTest.EasyTestRemotingRegistration.Register();
#endif
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            EditModelPermission.AlwaysGranted = Debugger.IsAttached;
            var winApplication =
                new SecuritySystemExampleWindowsFormsApplication();
            const string connectionString = "tcp://localhost:1426/DataServer";
            winApplication.ConnectionString = connectionString;
            try {
                var t = new Hashtable {
                    { "secure", true }, { "tokenImpersonationLevel", "impersonation" }
                };
                var channel = new TcpChannel(t, null, null);
                ChannelServices.RegisterChannel(channel, true);
                var clientDataServer = (IDataServer)Activator.GetObject(
                    typeof(RemoteSecuredDataServer), connectionString);
                var securityClient =
                    new ServerSecurityClient(clientDataServer, new ClientInfoFactory())
                {
                    IsSupportChangePassword = true
                };
                winApplication.ApplicationName = "SecuritySystemExample";
                winApplication.Security        = securityClient;
                winApplication.CreateCustomObjectSpaceProvider +=
                    delegate(object sender, CreateCustomObjectSpaceProviderEventArgs e) {
                    e.ObjectSpaceProvider =
                        new DataServerObjectSpaceProvider(clientDataServer, securityClient);
                };
                winApplication.UseOldTemplates = false;
                winApplication.Setup();
                winApplication.Start();
            }
            catch (Exception e) {
                winApplication.HandleException(e);
            }
        }
Beispiel #6
0
        static void Main()
        {
#if EASYTEST
            DevExpress.ExpressApp.Win.EasyTest.EasyTestRemotingRegistration.Register();
#endif

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            EditModelPermission.AlwaysGranted = Debugger.IsAttached;
            var winApplication = new SecuritySystemExampleWindowsFormsApplication();
            try {
                winApplication.ConnectionString = "http://localhost:1451/DataServer";
                XpandWcfDataServerHelper.AddKnownTypes();
                var defaultBinding = (WSHttpBinding)WcfDataServerHelper.CreateDefaultBinding();
                defaultBinding.ReaderQuotas.MaxStringContentLength = 2147483647;
                var clientDataServer = new WcfSecuredDataServerClient(
                    defaultBinding,
                    new EndpointAddress(winApplication.ConnectionString));
                var securityClient = new ServerSecurityClient(clientDataServer, new ClientInfoFactory())
                {
                    IsSupportChangePassword = true
                };
                winApplication.ApplicationName = "SecuritySystemExample";
                winApplication.Security        = securityClient;
                winApplication.CreateCustomObjectSpaceProvider +=
                    delegate(object sender, CreateCustomObjectSpaceProviderEventArgs e) {
                    e.ObjectSpaceProvider = new DataServerObjectSpaceProvider(clientDataServer, securityClient);
                };

                winApplication.UseOldTemplates = false;
                var worldCreatorTypeInfoSource = WorldCreatorTypeInfoSource.Instance;
                winApplication.Setup();
                winApplication.Start();
                clientDataServer.Close();
            }
            catch (Exception e) {
                winApplication.HandleException(e);
            }
        }
Beispiel #7
0
 protected virtual IObjectSpaceProvider CreateObjectSpaceProvider(OptimizedSecuredDataServerClient clientDataServer, ServerSecurityClient securityClient)
 {
     return(new DataServerObjectSpaceProvider(clientDataServer, securityClient));
 }