Beispiel #1
0
        private static IDataServer CreateDataServer()
        {
            EnsureWebApplicationInitialized();
            QueryRequestSecurityStrategyHandler securityProviderHandler = delegate()
            {
                AuthenticationBase authentication;
                if (AuthenticationCreator != null)
                {
                    authentication = AuthenticationCreator();
                }
                else
                {
                    authentication = new AuthenticationStandard();
                }
                var security = CreateDataServerSecurity(authentication);
                SecurityHelper.AttachRequestProcessors(security);
                return(security);
            };

            dataStore = dataStore ?? CreateDataStore();
            IDataLayer dataLayer = CreateDataLayer();

            var             securityStrategyProvider    = new CachingRequestSecurityStrategyProvider(new SecuredDataServer.RequestSecurityStrategyProvider(dataLayer, securityProviderHandler));
            IServerSecurity serverSecurity              = CreateDefaultServerSecurity(securityStrategyProvider);
            ISecuredSerializableObjectLayer objectLayer = CreateDefaultSecuredSerializableObjectLayer(dataLayer, securityStrategyProvider);

            return(new SecuredDataServer(serverSecurity, objectLayer));
        }
Beispiel #2
0
        /// <summary>
        /// Creates a new instance of HttpServer.
        /// </summary>
        /// <param name="myIPAddress">The IP address this server will listen for new connections.</param>
        /// <param name="myPort">The port this server will listen for new connections.</param>
        /// <param name="myServerLogic">An instance of the server logic. The class of this instance must implement at least one interface that is decorated with a ServiceContractAttribute.</param>
        /// <param name="mySecurity"></param>
        /// <param name="mySecureConnection">If true, this server will listen for request with HTTPS protocol, otherwise HTTP.</param>
        /// <param name="myAutoStart">If true, the method Start is called implicitly, otherwise not.</param>
        /// <exception cref="ArgumentNullException">If myIPAddress is <c>NULL</c>.</exception>
        /// <exception cref="ArgumentNullException">If myServerLogic is <c>NULL</c>.</exception>
        public HttpServer(IPAddress myIPAddress, ushort myPort, object myServerLogic, IServerSecurity mySecurity = null, bool mySecureConnection = false, bool myAutoStart = false)
        {
            #region argument checks

            if (myIPAddress == null)
            {
                throw new ArgumentNullException("myIPAddress");
            }

            if (myServerLogic == null)
            {
                throw new ArgumentNullException("myServerLogic");
            }

            #endregion

            #region set data

            ListeningAddress   = myIPAddress;
            ListeningPort      = myPort;
            IsSecureConnection = mySecureConnection;
            IsRunning          = false;

            _logic    = myServerLogic;
            _security = mySecurity;

            _parser = ParseInterface();

            #endregion

            CreateListener(); //create listener as late as possible

            _disposalService = new DisposalService(GetType().Name);
            //add close method to desposal service,
            //this service will provide that the dispose method won't be called multiple times
            _disposalService.AddManagedResourceDisposal(Close);

            if (myAutoStart)
            {
                Start();
            }
        }
 public XpandSecuredDataServer(IServerSecurity serverSecurity, ISecuredSerializableObjectLayer securedSerializableObjectLayer)
     : base(serverSecurity, securedSerializableObjectLayer)
 {
 }
Beispiel #4
0
        /// <summary>
        /// Creates a new instance of HttpServer.
        /// </summary>
        /// <param name="myIPAddress">The IP address this server will listen for new connections.</param>
        /// <param name="myPort">The port this server will listen for new connections.</param>
        /// <param name="myServerLogic">An instance of the server logic. The class of this instance must implement at least one interface that is decorated with a ServiceContractAttribute.</param>
        /// <param name="mySecurity"></param>
        /// <param name="mySecureConnection">If true, this server will listen for request with HTTPS protocol, otherwise HTTP.</param>
        /// <param name="myAutoStart">If true, the method Start is called implicitly, otherwise not.</param>
        /// <exception cref="ArgumentNullException">If myIPAddress is <c>NULL</c>.</exception>
        /// <exception cref="ArgumentNullException">If myServerLogic is <c>NULL</c>.</exception>
        public HttpServer(IPAddress myIPAddress, ushort myPort, object myServerLogic, IServerSecurity mySecurity = null, bool mySecureConnection = false, bool myAutoStart = false)
        {
            #region argument checks

            if (myIPAddress == null)
                throw new ArgumentNullException("myIPAddress");

            if (myServerLogic == null)
                throw new ArgumentNullException("myServerLogic");

            #endregion

            #region set data

            ListeningAddress = myIPAddress;
            ListeningPort = myPort;
            IsSecureConnection = mySecureConnection;
            IsRunning = false;

            _logic = myServerLogic;
            _security = mySecurity;

            _parser = ParseInterface();

            #endregion

            CreateListener(); //create listener as late as possible

            _disposalService = new DisposalService(GetType().Name);
            //add close method to desposal service,
            //this service will provide that the dispose method won't be called multiple times
            _disposalService.AddManagedResourceDisposal(Close);

            if (myAutoStart)
                Start();
        }
 public XpandSecuredDataServer(IServerSecurity serverSecurity, ISecuredSerializableObjectLayer securedSerializableObjectLayer)
     : base(serverSecurity, securedSerializableObjectLayer) {
 }