/// <summary>
 /// Creates instance of this class.
 /// </summary>
 /// <param name="contextOptions">Context options.</param>
 /// <param name="userOptions">User options.</param>
 /// <param name="logger">Logger instance.</param>
 /// <param name="logMethod">Logging method for specific platform.</param>
 /// <param name="eventsService">Server sent events service for user notifications.</param>
 /// <param name="engine">Engine instance.</param>
 public WebDAVHttpListener(
     IOptions <DavContextOptions> contextOptions,
     IOptions <DavUserOptions> userOptions,
     ILogger logger,
     ILogMethod logMethod,
     EventsService eventsService,
     DavEngineAsync engine
     )
 {
     this.contextOptions = contextOptions.Value;
     this.userOptions    = userOptions.Value;
     this.logger         = logger;
     this.eventsService  = eventsService;
     this.engine         = engine;
     this.logMethod      = logMethod;
     Features.Set <IHttpRequestFeature>(new HttpRequestFeature());
     Features.Set <IHttpResponseFeature>(new HttpResponseFeature());
     digestProvider = new DigestAuthenticationProvider(GetPasswordAndRoles);
 }
Example #2
0
        /// <summary>
        /// Initializes a new instance of the DavContext class.
        /// </summary>
        /// <param name="listenerContext"><see cref="HttpListenerContext"/> instance.</param>
        /// <param name="prefixes">Http listener prefixes.</param>
        /// <param name="repositoryPath">Local path to repository.</param>
        /// <param name="logger"><see cref="ILogger"/> instance.</param>
        public DavContext(
            HttpListenerContext listenerContext,
            HttpListenerPrefixCollection prefixes,
            System.Security.Principal.IPrincipal principal,
            string repositoryPath,
            ILogger logger,
            EventsService eventsService)
            : base(listenerContext, prefixes)
        {
            this.Logger         = logger;
            this.RepositoryPath = repositoryPath;
            this.eventsService  = eventsService;
            if (!Directory.Exists(repositoryPath))
            {
                Logger.LogError("Repository path specified in Web.config is invalid.", null);
            }

            if (principal != null)
            {
                Identity = principal.Identity;
            }
        }