コード例 #1
0
        public InProcSessionManager(InProcSessionsConfiguration configuration, IInProcSessionCache sessionCache, IInProcSessionFactory sessionFactory, IPeriodicCacheCleaner periodicCacheCleaner)
        {
            if (configuration == null)
            {
                throw new ArgumentNullException("configuration");
            }
            if (sessionCache == null)
            {
                throw new ArgumentNullException("sessionCache");
            }
            if (sessionFactory == null)
            {
                throw new ArgumentNullException("sessionFactory");
            }
            if (periodicCacheCleaner == null)
            {
                throw new ArgumentNullException("periodicCacheCleaner");
            }
            _configuration        = configuration;
            _sessionCache         = sessionCache;
            _sessionFactory       = sessionFactory;
            _periodicCacheCleaner = periodicCacheCleaner;

            // Start periodic cleaning
            _periodicCacheCleaner.Start();
        }
コード例 #2
0
 public InProcSessionFactoryFixture()
 {
     _fakeSystemClock    = A.Fake <ISystemClock>();
     _validConfiguration = new InProcSessionsConfiguration {
         SessionIdentificationMethod = A.Dummy <IInProcSessionIdentificationMethod>(), SessionTimeout = TimeSpan.FromMinutes(30)
     };
     _sessionFactory = new InProcSessionFactory(_validConfiguration, _fakeSystemClock);
 }
コード例 #3
0
 public PeriodicCacheCleaner(InProcSessionsConfiguration configuration, IInProcSessionCache sessionCache, IPeriodicTaskFactory periodicTaskFactory, ICancellationTokenSourceFactory cancellationTokenSourceFactory) {
   if (configuration == null) throw new ArgumentNullException("configuration");
   if (sessionCache == null) throw new ArgumentNullException("sessionCache");
   if (periodicTaskFactory == null) throw new ArgumentNullException("periodicTaskFactory");
   if (cancellationTokenSourceFactory == null) throw new ArgumentNullException("cancellationTokenSourceFactory");
   _configuration = configuration;
   _cancellationTokenSourceFactory = cancellationTokenSourceFactory;
   _periodicTask = periodicTaskFactory.Create(sessionCache.Trim);
 }
 public InProcSessionManagerFixture() {
   _nancyContext = new NancyContext();
   _fakeSessionIdentificationMethod = A.Fake<IInProcSessionIdentificationMethod>();
   _validConfiguration = new InProcSessionsConfiguration {SessionIdentificationMethod = _fakeSessionIdentificationMethod, SessionTimeout = TimeSpan.FromMinutes(30), CacheTrimInterval = TimeSpan.FromMinutes(40)};
   _fakeSessionCache = A.Fake<IInProcSessionCache>();
   _fakeSessionFactory = A.Fake<IInProcSessionFactory>();
   _fakePeriodicCacheCleaner = A.Fake<IPeriodicCacheCleaner>();
   _sessionManager = new InProcSessionManager(_validConfiguration, _fakeSessionCache, _fakeSessionFactory, _fakePeriodicCacheCleaner);
 }
コード例 #5
0
 public InProcSessionManagerFixture()
 {
     _nancyContext = new NancyContext();
     _fakeSessionIdentificationMethod = A.Fake <IInProcSessionIdentificationMethod>();
     _validConfiguration = new InProcSessionsConfiguration {
         SessionIdentificationMethod = _fakeSessionIdentificationMethod, SessionTimeout = TimeSpan.FromMinutes(30), CacheTrimInterval = TimeSpan.FromMinutes(40)
     };
     _fakeSessionCache         = A.Fake <IInProcSessionCache>();
     _fakeSessionFactory       = A.Fake <IInProcSessionFactory>();
     _fakePeriodicCacheCleaner = A.Fake <IPeriodicCacheCleaner>();
     _sessionManager           = new InProcSessionManager(_validConfiguration, _fakeSessionCache, _fakeSessionFactory, _fakePeriodicCacheCleaner);
 }
コード例 #6
0
 public InProcSessionFactory(InProcSessionsConfiguration configuration, ISystemClock systemClock)
 {
     if (configuration == null)
     {
         throw new ArgumentNullException("configuration");
     }
     if (systemClock == null)
     {
         throw new ArgumentNullException("systemClock");
     }
     _configuration = configuration;
     _systemClock   = systemClock;
 }
    public PeriodicCacheCleanerFixture() {
      _fakeSessionCache = A.Fake<IInProcSessionCache>();
      _fakePeriodicTaskFactory = A.Fake<IPeriodicTaskFactory>();
      _fakePeriodicTask = A.Fake<IPeriodicTask>();
      _fakeCancellationTokenSourceFactory = A.Fake<ICancellationTokenSourceFactory>();
      _validConfiguration = new InProcSessionsConfiguration();

      _cancellationTokenSource = new CancellationTokenSource();
      A.CallTo(() => _fakeCancellationTokenSourceFactory.Create()).Returns(_cancellationTokenSource);
      A.CallTo(() => _fakePeriodicTaskFactory.Create(A<Action>._)).Returns(_fakePeriodicTask);

      _periodicCacheCleaner = new PeriodicCacheCleaner(_validConfiguration, _fakeSessionCache, _fakePeriodicTaskFactory, _fakeCancellationTokenSourceFactory);
    }
コード例 #8
0
    public InProcSessionManager(InProcSessionsConfiguration configuration, IInProcSessionCache sessionCache, IInProcSessionFactory sessionFactory, IPeriodicCacheCleaner periodicCacheCleaner) {
      if (configuration == null) throw new ArgumentNullException("configuration");
      if (sessionCache == null) throw new ArgumentNullException("sessionCache");
      if (sessionFactory == null) throw new ArgumentNullException("sessionFactory");
      if (periodicCacheCleaner == null) throw new ArgumentNullException("periodicCacheCleaner");
      _configuration = configuration;
      _sessionCache = sessionCache;
      _sessionFactory = sessionFactory;
      _periodicCacheCleaner = periodicCacheCleaner;

      // Start periodic cleaning
      _periodicCacheCleaner.Start();
    }
コード例 #9
0
        protected override void ApplicationStartup(TinyIoCContainer container, IPipelines pipelines)
        {
            StaticConfiguration.DisableErrorTraces = false;

            var sessionConfig = new InProcSessionsConfiguration {
                SessionTimeout              = TimeSpan.FromMinutes(3),
                CacheTrimInterval           = TimeSpan.FromMinutes(10),
                SessionIdentificationMethod = new ByQueryStringParamIdentificationMethod(CryptographyConfiguration.Default)
            };

            pipelines.EnableInProcSessions(sessionConfig);

            base.ApplicationStartup(container, pipelines);
        }
コード例 #10
0
        public PeriodicCacheCleanerFixture()
        {
            _fakeSessionCache                   = A.Fake <IInProcSessionCache>();
            _fakePeriodicTaskFactory            = A.Fake <IPeriodicTaskFactory>();
            _fakePeriodicTask                   = A.Fake <IPeriodicTask>();
            _fakeCancellationTokenSourceFactory = A.Fake <ICancellationTokenSourceFactory>();
            _validConfiguration                 = new InProcSessionsConfiguration();

            _cancellationTokenSource = new CancellationTokenSource();
            A.CallTo(() => _fakeCancellationTokenSourceFactory.Create()).Returns(_cancellationTokenSource);
            A.CallTo(() => _fakePeriodicTaskFactory.Create(A <Action> ._)).Returns(_fakePeriodicTask);

            _periodicCacheCleaner = new PeriodicCacheCleaner(_validConfiguration, _fakeSessionCache, _fakePeriodicTaskFactory, _fakeCancellationTokenSourceFactory);
        }
 public ByQueryStringParamIdentificationMethodFixture() {
   _fakeEncryptionProvider = A.Fake<IEncryptionProvider>();
   _fakeHmacProvider = A.Fake<IHmacProvider>();
   _validConfiguration = new InProcSessionsConfiguration();
   _fakeSessionIdentificationDataProvider = A.Fake<ISessionIdentificationDataProvider>();
   _fakeHmacValidator = A.Fake<IHmacValidator>();
   _fakeSessionIdFactory = A.Fake<ISessionIdFactory>();
   _fakeResponseManipulatorForSession = A.Fake<IResponseManipulatorForSession>();
   _byQueryStringParamIdentificationMethod = new ByQueryStringParamIdentificationMethod(
     _fakeEncryptionProvider,
     _fakeHmacProvider,
     _fakeSessionIdentificationDataProvider,
     _fakeHmacValidator,
     _fakeSessionIdFactory,
     _fakeResponseManipulatorForSession);
   _parameterName = "TheNameOfTheParameter";
   _byQueryStringParamIdentificationMethod.ParameterName = _parameterName;
 }
 public BySessionIdCookieIdentificationMethodFixture() {
   _fakeEncryptionProvider = A.Fake<IEncryptionProvider>();
   _fakeHmacProvider = A.Fake<IHmacProvider>();
   _validConfiguration = new InProcSessionsConfiguration();
   _fakeSessionIdentificationDataProvider = A.Fake<ISessionIdentificationDataProvider>();
   _fakeHmacValidator = A.Fake<IHmacValidator>();
   _fakeSessionIdFactory = A.Fake<ISessionIdFactory>();
   _fakeCookieFactory = A.Fake<ICookieFactory>();
   _bySessionIdCookieIdentificationMethod = new BySessionIdCookieIdentificationMethod(
     _fakeEncryptionProvider,
     _fakeHmacProvider,
     _fakeSessionIdentificationDataProvider,
     _fakeHmacValidator,
     _fakeSessionIdFactory,
     _fakeCookieFactory);
   _cookieName = "TheNameOfTheCookie";
   _bySessionIdCookieIdentificationMethod.CookieName = _cookieName;
 }
 public BySessionIdCookieIdentificationMethodFixture()
 {
     _fakeEncryptionProvider = A.Fake <IEncryptionProvider>();
     _fakeHmacProvider       = A.Fake <IHmacProvider>();
     _validConfiguration     = new InProcSessionsConfiguration();
     _fakeSessionIdentificationDataProvider = A.Fake <ISessionIdentificationDataProvider>();
     _fakeHmacValidator    = A.Fake <IHmacValidator>();
     _fakeSessionIdFactory = A.Fake <ISessionIdFactory>();
     _fakeCookieFactory    = A.Fake <ICookieFactory>();
     _bySessionIdCookieIdentificationMethod = new BySessionIdCookieIdentificationMethod(
         _fakeEncryptionProvider,
         _fakeHmacProvider,
         _fakeSessionIdentificationDataProvider,
         _fakeHmacValidator,
         _fakeSessionIdFactory,
         _fakeCookieFactory);
     _cookieName = "TheNameOfTheCookie";
     _bySessionIdCookieIdentificationMethod.CookieName = _cookieName;
 }
 public ByQueryStringParamIdentificationMethodFixture()
 {
     _fakeEncryptionProvider = A.Fake <IEncryptionProvider>();
     _fakeHmacProvider       = A.Fake <IHmacProvider>();
     _validConfiguration     = new InProcSessionsConfiguration();
     _fakeSessionIdentificationDataProvider = A.Fake <ISessionIdentificationDataProvider>();
     _fakeHmacValidator    = A.Fake <IHmacValidator>();
     _fakeSessionIdFactory = A.Fake <ISessionIdFactory>();
     _fakeResponseManipulatorForSession      = A.Fake <IResponseManipulatorForSession>();
     _byQueryStringParamIdentificationMethod = new ByQueryStringParamIdentificationMethod(
         _fakeEncryptionProvider,
         _fakeHmacProvider,
         _fakeSessionIdentificationDataProvider,
         _fakeHmacValidator,
         _fakeSessionIdFactory,
         _fakeResponseManipulatorForSession);
     _parameterName = "TheNameOfTheParameter";
     _byQueryStringParamIdentificationMethod.ParameterName = _parameterName;
 }
コード例 #15
0
 public PeriodicCacheCleaner(InProcSessionsConfiguration configuration, IInProcSessionCache sessionCache, IPeriodicTaskFactory periodicTaskFactory, ICancellationTokenSourceFactory cancellationTokenSourceFactory)
 {
     if (configuration == null)
     {
         throw new ArgumentNullException("configuration");
     }
     if (sessionCache == null)
     {
         throw new ArgumentNullException("sessionCache");
     }
     if (periodicTaskFactory == null)
     {
         throw new ArgumentNullException("periodicTaskFactory");
     }
     if (cancellationTokenSourceFactory == null)
     {
         throw new ArgumentNullException("cancellationTokenSourceFactory");
     }
     _configuration = configuration;
     _cancellationTokenSourceFactory = cancellationTokenSourceFactory;
     _periodicTask = periodicTaskFactory.Create(sessionCache.Trim);
 }
コード例 #16
0
 public InProcSessionFactory(InProcSessionsConfiguration configuration, ISystemClock systemClock) {
   if (configuration == null) throw new ArgumentNullException("configuration");
   if (systemClock == null) throw new ArgumentNullException("systemClock");
   _configuration = configuration;
   _systemClock = systemClock;
 }