Exemplo n.º 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();
            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);
            }
        }
Exemplo n.º 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();
            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);
            }
        }
        static void Main()
        {
#if EASYTEST
            DevExpress.ExpressApp.Win.EasyTest.EasyTestRemotingRegistration.Register();
#endif
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            EditModelPermission.AlwaysGranted = System.Diagnostics.Debugger.IsAttached;
            SecuritySystemExampleWindowsFormsApplication winApplication = new SecuritySystemExampleWindowsFormsApplication();
            InMemoryDataStoreProvider.Register();
            winApplication.ConnectionString = InMemoryDataStoreProvider.ConnectionString;
            try {
                winApplication.Setup();
                winApplication.Start();
            }
            catch (Exception e) {
                winApplication.HandleException(e);
            }
        }
Exemplo n.º 4
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);
            }
        }
Exemplo n.º 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();
            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);
            }
        }