/// <summary>
        /// Setups the logger using global settings
        /// </summary>
        /// <param name="globalSettings">The global settings.</param>
        public static void Setup(IGlobalSettings globalSettings)
        {
            bool blnConfigured = false;
            try
            {
                //if an xml file is present use that
                var executingFile = new FileInfo(Assembly.GetExecutingAssembly().Location);
                if (executingFile.Directory != null)
                {
                    var file = new FileInfo(Path.Combine(executingFile.Directory.FullName, "log.config"));
                    if (file.Exists)
                    {
                        log4net.Config.XmlConfigurator.Configure(file);
                        blnConfigured = true;
                    }
                }
            }
            catch
            {
            }

            //if no configruation file was found via global settings (or it failed)
            //use fallback default 
            if (blnConfigured == false)
            {
                var patternLayout = new PatternLayout
                {
                    Header = new PatternString("[START MODE=%property{StartMode} DATE=%date{yyyy-MM-dd HH:mm:ss}]\r\n").Format(),
                    Footer = "[END]\r\n",
                    ConversionPattern = "[%date{yyyy-MM-dd HH:mm:ss}] - %message%newline%exception"
                };


                var roller = new RollingFileAppender
                {
                    Name = "P99AuctionLogger",
                    AppendToFile = true,
                    File = globalSettings.LogFileName,
                    Layout = patternLayout,
                    MaxSizeRollBackups = 5,
                    MaximumFileSize = "10MB",
                    RollingStyle = RollingFileAppender.RollingMode.Size
                };


                var hierarchy = (log4net.Repository.Hierarchy.Hierarchy) LogManager.GetRepository();
                var root = hierarchy.Root;
                var attachable = root as IAppenderAttachable;
                root.Level = Level.Warn;

                if (attachable != null)
                {
                    attachable.AddAppender(roller);
                    roller.ActivateOptions();
                }

                hierarchy.Configured = true;
            }
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="ApplicationHostNutConfiguration"/> class.
        /// </summary>
        public ApplicationHostNutConfiguration()
        {
            var appSettings = new AppConfigApplicationSettings();
            _applicationSettings = appSettings;
            _globalSettings = appSettings;

            _connectionStrings = new AppConfigConnectionStrings();
        }
Exemplo n.º 3
0
        /// <summary>
        /// Outputs a script tag containing the bare minimum (non secure) server vars for use with the angular app
        /// </summary>
        /// <param name="html"></param>
        /// <param name="uri"></param>
        /// <param name="externalLoginsUrl">
        /// The post URL used to sign in with external logins - this can change depending on for what service the external login is service.
        /// Example: normal back office login or authenticating upgrade login
        /// </param>
        /// <param name="features"></param>
        /// <param name="globalSettings"></param>
        /// <returns></returns>
        /// <remarks>
        /// These are the bare minimal server variables that are required for the application to start without being authenticated,
        /// we will load the rest of the server vars after the user is authenticated.
        /// </remarks>
        public static IHtmlString BareMinimumServerVariablesScript(this HtmlHelper html, UrlHelper uri, string externalLoginsUrl, UmbracoFeatures features, IGlobalSettings globalSettings)
        {
            var serverVars = new BackOfficeServerVariables(uri, Current.RuntimeState, features, globalSettings);
            var minVars    = serverVars.BareMinimumServerVariables();

            var str = @"<script type=""text/javascript"">
                var Umbraco = {};
                Umbraco.Sys = {};
                Umbraco.Sys.ServerVariables = " + JsonConvert.SerializeObject(minVars) + @";
            </script>";

            return(html.Raw(str));
        }
Exemplo n.º 4
0
 public MacrosController(IGlobalSettings globalSettings, IUmbracoContextAccessor umbracoContextAccessor, ISqlContext sqlContext, ServiceContext services, AppCaches appCaches, IProfilingLogger logger, IRuntimeState runtimeState, UmbracoHelper umbracoHelper)
     : base(globalSettings, umbracoContextAccessor, sqlContext, services, appCaches, logger, runtimeState, umbracoHelper)
 {
     _macroService = Services.MacroService;
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="ClientController" /> class.
        /// </summary>
        /// <param name="clientSettings">The client settings.</param>
        /// <param name="globalSettings">The global settings.</param>
        /// <param name="balloonController">The balloon controller.</param>
        /// <param name="logger">The logger.</param>
        /// <param name="dataDispatcher">The data dispatcher.</param>
        /// <param name="viewResolver">The view resolver.</param>
        /// <exception cref="ArgumentNullException">
        /// </exception>
        /// <exception cref="System.ArgumentNullException"></exception>
        public ClientController(IClientSettings clientSettings, IGlobalSettings globalSettings, IBalloonController balloonController, ILog logger, IDataDispatcher dataDispatcher, IViewResolver viewResolver)
        {
            if (clientSettings == null) throw new ArgumentNullException(nameof(clientSettings));
            if (globalSettings == null) throw new ArgumentNullException(nameof(globalSettings));
            if (balloonController == null) throw new ArgumentNullException(nameof(balloonController));
            if (logger == null) throw new ArgumentNullException(nameof(logger));
            if (dataDispatcher == null) throw new ArgumentNullException(nameof(dataDispatcher));
            if (viewResolver == null) throw new ArgumentNullException(nameof(viewResolver));

            _balloonController = balloonController;
            _clientSettings = clientSettings;
            _globalSettings = globalSettings;
            _viewResolver = viewResolver;
            _logger = logger;
            _dataDispatcher = dataDispatcher;
            
            //setup the view model for the notification window (sys tray)
            _notificationModel = new NotifyIconViewModel();
            _notificationModel.ExitApplication += this.MainWindow_CloseExplicit;
            _notificationModel.ShowAuctionTracker += this.NotificationView_ShowAuctionTracker;

            //wire up the dispatcher
            _dataDispatcher.MessageReceived += this.MessageMonitor_MessageReceived;
            _dataDispatcher.StatusChanged += this.DataDispatcher_StatusChanged;

            //Primary window view model
            _trackerWindowModel = new MainWindowViewModel();

            //status message switcher
            _uiMessageQueue = new UiMessageQueue(500);
            _uiMessageQueue.ActiveItemChanged += this.UiMessageQueue_ActiveItemChanged;
        }
Exemplo n.º 6
0
        /// <summary>
        /// In order for preview to work this needs to be called
        /// </summary>
        /// <param name="app"></param>
        /// <param name="umbracoContextAccessor"></param>
        /// <param name="runtimeState"></param>
        /// <param name="globalSettings"></param>
        /// <param name="securitySettings"></param>
        /// <param name="stage"></param>
        /// <returns></returns>
        /// <remarks>
        /// This ensures that during a preview request that the back office use is also Authenticated and that the back office Identity
        /// is added as a secondary identity to the current IPrincipal so it can be used to Authorize the previewed document.
        /// </remarks>
        public static IAppBuilder UseUmbracoPreviewAuthentication(this IAppBuilder app, IUmbracoContextAccessor umbracoContextAccessor, IRuntimeState runtimeState, IGlobalSettings globalSettings, ISecuritySection securitySettings, PipelineStage stage)
        {
            if (runtimeState.Level != RuntimeLevel.Run)
            {
                return(app);
            }

            var authOptions = app.CreateUmbracoCookieAuthOptions(umbracoContextAccessor, globalSettings, runtimeState, securitySettings);

            app.Use(typeof(PreviewAuthenticationMiddleware), authOptions, Current.Configs.Global());

            // This middleware must execute at least on PostAuthentication, by default it is on Authorize
            // The middleware needs to execute after the RoleManagerModule executes which is during PostAuthenticate,
            // currently I've had 100% success with ensuring this fires after RoleManagerModule even if this is set
            // to PostAuthenticate though not sure if that's always a guarantee so by default it's Authorize.
            if (stage < PipelineStage.PostAuthenticate)
            {
                throw new InvalidOperationException("The stage specified for UseUmbracoPreviewAuthentication must be greater than or equal to " + PipelineStage.PostAuthenticate);
            }

            app.UseStageMarker(stage);
            return(app);
        }
Exemplo n.º 7
0
 public HttpsCheck(ILocalizedTextService textService, IRuntimeState runtime, IGlobalSettings globalSettings)
 {
     _textService    = textService;
     _runtime        = runtime;
     _globalSettings = globalSettings;
 }
Exemplo n.º 8
0
        /// <summary>
        /// Ensures that the UmbracoBackOfficeAuthenticationMiddleware is assigned to the pipeline
        /// </summary>
        /// <param name="app"></param>
        /// <param name="umbracoContextAccessor"></param>
        /// <param name="runtimeState"></param>
        /// <param name="userService"></param>
        /// <param name="globalSettings"></param>
        /// <param name="securitySection"></param>
        /// <param name="stage">
        /// Configurable pipeline stage
        /// </param>
        /// <returns></returns>
        public static IAppBuilder UseUmbracoBackOfficeCookieAuthentication(this IAppBuilder app, IUmbracoContextAccessor umbracoContextAccessor, IRuntimeState runtimeState, IUserService userService, IGlobalSettings globalSettings, ISecuritySection securitySection, PipelineStage stage)
        {
            //Create the default options and provider
            var authOptions = app.CreateUmbracoCookieAuthOptions(umbracoContextAccessor, globalSettings, runtimeState, securitySection);

            authOptions.Provider = new BackOfficeCookieAuthenticationProvider(userService, runtimeState, globalSettings)
            {
                // Enables the application to validate the security stamp when the user
                // logs in. This is a security feature which is used when you
                // change a password or add an external login to your account.
                OnValidateIdentity = SecurityStampValidator
                                     .OnValidateIdentity <BackOfficeUserManager, BackOfficeIdentityUser, int>(
                    TimeSpan.FromMinutes(30),
                    (manager, user) => manager.GenerateUserIdentityAsync(user),
                    identity => identity.GetUserId <int>()),
            };

            return(app.UseUmbracoBackOfficeCookieAuthentication(umbracoContextAccessor, runtimeState, globalSettings, securitySection, authOptions, stage));
        }
Exemplo n.º 9
0
 /// <summary>
 /// Ensures that the cookie middleware for validating external logins is assigned to the pipeline with the correct
 /// Umbraco back office configuration
 /// </summary>
 /// <param name="app"></param>
 /// <param name="umbracoContextAccessor"></param>
 /// <param name="runtimeState"></param>
 /// <param name="globalSettings"></param>
 /// <returns></returns>
 /// <remarks>
 /// By default this will be configured to execute on PipelineStage.Authenticate
 /// </remarks>
 public static IAppBuilder UseUmbracoBackOfficeExternalCookieAuthentication(this IAppBuilder app, IUmbracoContextAccessor umbracoContextAccessor, IRuntimeState runtimeState, IGlobalSettings globalSettings)
 {
     return(app.UseUmbracoBackOfficeExternalCookieAuthentication(umbracoContextAccessor, runtimeState, globalSettings, PipelineStage.Authenticate));
 }
Exemplo n.º 10
0
 public SlackWebHookHandler(ITopicService topicService, IGlobalSettings globalSettings)
 {
     _topicService = topicService;
     _globalSettings = globalSettings;
     this.Receiver = SlackWebHookReceiver.ReceiverName;
 }
Exemplo n.º 11
0
        /// <summary>
        /// Configure a custom BackOfficeUserManager for Umbraco
        /// </summary>
        /// <param name="app"></param>
        /// <param name="runtimeState"></param>
        /// <param name="globalSettings"></param>
        /// <param name="userManager"></param>
        public static void ConfigureUserManagerForUmbracoBackOffice <TManager, TUser>(this IAppBuilder app,
                                                                                      IRuntimeState runtimeState,
                                                                                      IGlobalSettings globalSettings,
                                                                                      Func <IdentityFactoryOptions <TManager>, IOwinContext, TManager> userManager)
            where TManager : BackOfficeUserManager <TUser>
            where TUser : BackOfficeIdentityUser
        {
            if (runtimeState == null)
            {
                throw new ArgumentNullException(nameof(runtimeState));
            }
            if (userManager == null)
            {
                throw new ArgumentNullException(nameof(userManager));
            }

            //Configure Umbraco user manager to be created per request
            app.CreatePerOwinContext <TManager>(userManager);

            app.SetBackOfficeUserManagerType <TManager, TUser>();

            //Create a sign in manager per request
            app.CreatePerOwinContext <BackOfficeSignInManager>(
                (options, context) => BackOfficeSignInManager.Create(options, context, globalSettings, app.CreateLogger(typeof(BackOfficeSignInManager).FullName)));
        }
Exemplo n.º 12
0
 public static BackOfficeSignInManager Create(IdentityFactoryOptions <BackOfficeSignInManager> options, IOwinContext context, IGlobalSettings globalSettings, ILogger logger)
 {
     return(new BackOfficeSignInManager(
                context.GetBackOfficeUserManager(),
                context.Authentication,
                logger,
                globalSettings,
                context.Request));
 }
Exemplo n.º 13
0
 public InstallController(IUmbracoContextAccessor umbracoContextAccessor, InstallHelper installHelper, IRuntimeState runtime, ILogger logger, IGlobalSettings globalSettings)
 {
     _umbracoContextAccessor = umbracoContextAccessor;
     _installHelper          = installHelper;
     _runtime        = runtime;
     _logger         = logger;
     _globalSettings = globalSettings;
 }
Exemplo n.º 14
0
 public BackOfficeSignInManager(UserManager <BackOfficeIdentityUser, int> userManager, IAuthenticationManager authenticationManager, ILogger logger, IGlobalSettings globalSettings, IOwinRequest request)
     : base(userManager, authenticationManager)
 {
     if (logger == null)
     {
         throw new ArgumentNullException("logger");
     }
     if (request == null)
     {
         throw new ArgumentNullException("request");
     }
     _logger            = logger;
     _request           = request;
     _globalSettings    = globalSettings;
     AuthenticationType = Constants.Security.BackOfficeAuthenticationType;
 }
Exemplo n.º 15
0
 public NewInstallStep(HttpContextBase http, IUserService userService, DatabaseBuilder databaseBuilder, IGlobalSettings globalSettings)
 {
     _http            = http;
     _userService     = userService;
     _databaseBuilder = databaseBuilder;
     _globalSettings  = globalSettings;
 }
Exemplo n.º 16
0
 public ConnectionManager RegisterGlobalSettings(IGlobalSettings settings)
 {
     _globalSettings = settings;
     return(this);
 }
 public AutoScalingGroup(IGlobalSettings globalSettings) : base(globalSettings)
 {
 }
Exemplo n.º 18
0
 public HomeController(IGlobalSettings globalSettings)
 {
     _globalSettings = globalSettings;
 }
Exemplo n.º 19
0
 protected ContentControllerBase(IGlobalSettings globalSettings, IUmbracoContextAccessor umbracoContextAccessor, ISqlContext sqlContext, ServiceContext services, AppCaches appCaches, IProfilingLogger logger, IRuntimeState runtimeState, UmbracoHelper umbracoHelper)
     : base(globalSettings, umbracoContextAccessor, sqlContext, services, appCaches, logger, runtimeState, umbracoHelper)
 {
 }
Exemplo n.º 20
0
 public MediaTypeController(ICultureDictionaryFactory cultureDictionaryFactory, IGlobalSettings globalSettings, IUmbracoContextAccessor umbracoContextAccessor, ISqlContext sqlContext, ServiceContext services, AppCaches appCaches, IProfilingLogger logger, IRuntimeState runtimeState, UmbracoHelper umbracoHelper)
     : base(cultureDictionaryFactory, globalSettings, umbracoContextAccessor, sqlContext, services, appCaches, logger, runtimeState, umbracoHelper)
 {
 }
Exemplo n.º 21
0
 /// <summary>
 /// Ensures that the UmbracoBackOfficeAuthenticationMiddleware is assigned to the pipeline
 /// </summary>
 /// <param name="app"></param>
 /// <param name="umbracoContextAccessor"></param>
 /// <param name="runtimeState"></param>
 /// <param name="userService"></param>
 /// <param name="globalSettings"></param>
 /// <param name="securitySection"></param>
 /// <returns></returns>
 /// <remarks>
 /// By default this will be configured to execute on PipelineStage.Authenticate
 /// </remarks>
 public static IAppBuilder UseUmbracoBackOfficeCookieAuthentication(this IAppBuilder app, IUmbracoContextAccessor umbracoContextAccessor, IRuntimeState runtimeState, IUserService userService, IGlobalSettings globalSettings, ISecuritySection securitySection)
 {
     return(app.UseUmbracoBackOfficeCookieAuthentication(umbracoContextAccessor, runtimeState, userService, globalSettings, securitySection, PipelineStage.Authenticate));
 }
Exemplo n.º 22
0
 public MediaController(PropertyEditorCollection propertyEditors, IGlobalSettings globalSettings, IUmbracoContextAccessor umbracoContextAccessor, ISqlContext sqlContext, ServiceContext services, AppCaches appCaches, IProfilingLogger logger, IRuntimeState runtimeState, UmbracoHelper umbracoHelper, IContentTypeBaseServiceProvider contentTypeBaseServiceProvider)
     : base(globalSettings, umbracoContextAccessor, sqlContext, services, appCaches, logger, runtimeState, umbracoHelper)
 {
     _propertyEditors = propertyEditors ?? throw new ArgumentNullException(nameof(propertyEditors));
     _contentTypeBaseServiceProvider = contentTypeBaseServiceProvider;
 }
Exemplo n.º 23
0
        /// <summary>
        /// Ensures that the UmbracoBackOfficeAuthenticationMiddleware is assigned to the pipeline
        /// </summary>
        /// <param name="app"></param>
        /// <param name="umbracoContextAccessor"></param>
        /// <param name="runtimeState"></param>
        /// <param name="globalSettings"></param>
        /// <param name="securitySection"></param>
        /// <param name="cookieOptions">Custom auth cookie options can be specified to have more control over the cookie authentication logic</param>
        /// <param name="stage">
        /// Configurable pipeline stage
        /// </param>
        /// <returns></returns>
        public static IAppBuilder UseUmbracoBackOfficeCookieAuthentication(this IAppBuilder app, IUmbracoContextAccessor umbracoContextAccessor, IRuntimeState runtimeState, IGlobalSettings globalSettings, ISecuritySection securitySection, CookieAuthenticationOptions cookieOptions, PipelineStage stage)
        {
            if (app == null)
            {
                throw new ArgumentNullException(nameof(app));
            }
            if (runtimeState == null)
            {
                throw new ArgumentNullException(nameof(runtimeState));
            }
            if (cookieOptions == null)
            {
                throw new ArgumentNullException(nameof(cookieOptions));
            }
            if (cookieOptions.Provider == null)
            {
                throw new ArgumentNullException("cookieOptions.Provider cannot be null.", nameof(cookieOptions));
            }
            if (cookieOptions.Provider is BackOfficeCookieAuthenticationProvider == false)
            {
                throw new ArgumentException($"cookieOptions.Provider must be of type {typeof(BackOfficeCookieAuthenticationProvider)}.", nameof(cookieOptions));
            }

            app.UseUmbracoBackOfficeCookieAuthenticationInternal(cookieOptions, runtimeState, stage);

            //don't apply if app is not ready
            if (runtimeState.Level != RuntimeLevel.Upgrade && runtimeState.Level != RuntimeLevel.Run)
            {
                return(app);
            }

            var cookieAuthOptions = app.CreateUmbracoCookieAuthOptions(
                umbracoContextAccessor, globalSettings, runtimeState, securitySection,
                //This defines the explicit path read cookies from for this middleware
                new[] { $"{globalSettings.Path}/backoffice/UmbracoApi/Authentication/GetRemainingTimeoutSeconds" });

            cookieAuthOptions.Provider = cookieOptions.Provider;

            //This is a custom middleware, we need to return the user's remaining logged in seconds
            app.Use <GetUserSecondsMiddleWare>(
                cookieAuthOptions,
                Current.Configs.Global(),
                Current.Configs.Settings().Security,
                app.CreateLogger <GetUserSecondsMiddleWare>());

            //This is required so that we can read the auth ticket format outside of this pipeline
            app.CreatePerOwinContext <UmbracoAuthTicketDataProtector>(
                (options, context) => new UmbracoAuthTicketDataProtector(cookieOptions.TicketDataFormat));

            return(app);
        }
 public AuthenticationController(IGlobalSettings globalSettings, IUmbracoContextAccessor umbracoContextAccessor, ISqlContext sqlContext, ServiceContext services, AppCaches appCaches, IProfilingLogger logger, IRuntimeState runtimeState, UmbracoHelper umbracoHelper)
     : base(globalSettings, umbracoContextAccessor, sqlContext, services, appCaches, logger, runtimeState, umbracoHelper, Current.Mapper)
 {
 }
Exemplo n.º 25
0
 /// <summary>
 /// In order for preview to work this needs to be called
 /// </summary>
 /// <param name="app"></param>
 /// <param name="umbracoContextAccessor"></param>
 /// <param name="runtimeState"></param>
 /// <param name="globalSettings"></param>
 /// <param name="securitySettings"></param>
 /// <returns></returns>
 /// <remarks>
 /// This ensures that during a preview request that the back office use is also Authenticated and that the back office Identity
 /// is added as a secondary identity to the current IPrincipal so it can be used to Authorize the previewed document.
 /// </remarks>
 /// <remarks>
 /// By default this will be configured to execute on PipelineStage.PostAuthenticate
 /// </remarks>
 public static IAppBuilder UseUmbracoPreviewAuthentication(this IAppBuilder app, IUmbracoContextAccessor umbracoContextAccessor, IRuntimeState runtimeState, IGlobalSettings globalSettings, ISecuritySection securitySettings)
 {
     return(app.UseUmbracoPreviewAuthentication(umbracoContextAccessor, runtimeState, globalSettings, securitySettings, PipelineStage.PostAuthenticate));
 }
Exemplo n.º 26
0
 protected UmbracoWebService(IProfilingLogger profilingLogger, IUmbracoContextAccessor umbracoContextAccessor, UmbracoHelper umbraco, ServiceContext services, IGlobalSettings globalSettings)
 {
     Logger                 = profilingLogger;
     ProfilingLogger        = profilingLogger;
     UmbracoContextAccessor = umbracoContextAccessor;
     Umbraco                = umbraco;
     Services               = services;
     GlobalSettings         = globalSettings;
 }
Exemplo n.º 27
0
        /// <summary>
        /// Create the default umb cookie auth options
        /// </summary>
        /// <param name="app"></param>
        /// <param name="umbracoContextAccessor"></param>
        /// <param name="globalSettings"></param>
        /// <param name="runtimeState"></param>
        /// <param name="securitySettings"></param>
        /// <param name="explicitPaths"></param>
        /// <returns></returns>
        public static UmbracoBackOfficeCookieAuthOptions CreateUmbracoCookieAuthOptions(this IAppBuilder app,
                                                                                        IUmbracoContextAccessor umbracoContextAccessor,
                                                                                        IGlobalSettings globalSettings, IRuntimeState runtimeState, ISecuritySection securitySettings, string[] explicitPaths = null)
        {
            //this is how aspnet wires up the default AuthenticationTicket protector so we'll use the same code
            var ticketDataFormat = new TicketDataFormat(
                app.CreateDataProtector(typeof(CookieAuthenticationMiddleware).FullName,
                                        Constants.Security.BackOfficeAuthenticationType,
                                        "v1"));

            var authOptions = new UmbracoBackOfficeCookieAuthOptions(
                explicitPaths,
                umbracoContextAccessor,
                securitySettings,
                globalSettings,
                runtimeState,
                ticketDataFormat);

            return(authOptions);
        }
Exemplo n.º 28
0
        internal static string TryGetApplicationUrl(IUmbracoSettingsSection settings, ILogger logger, IGlobalSettings globalSettings, IServerRegistrar serverRegistrar)
        {
            // try umbracoSettings:settings/web.routing/@umbracoApplicationUrl
            // which is assumed to:
            // - end with SystemDirectories.Umbraco
            // - contain a scheme
            // - end or not with a slash, it will be taken care of
            // eg "http://www.mysite.com/umbraco"
            var url = settings.WebRouting.UmbracoApplicationUrl;

            if (url.IsNullOrWhiteSpace() == false)
            {
                var umbracoApplicationUrl = url.TrimEnd('/');
                logger.Info(TypeOfApplicationUrlHelper, "ApplicationUrl: {UmbracoAppUrl} (using web.routing/@umbracoApplicationUrl)", umbracoApplicationUrl);
                return(umbracoApplicationUrl);
            }

            // try the server registrar
            // which is assumed to return a url that:
            // - end with SystemDirectories.Umbraco
            // - contain a scheme
            // - end or not with a slash, it will be taken care of
            // eg "http://www.mysite.com/umbraco"
            url = serverRegistrar.GetCurrentServerUmbracoApplicationUrl();
            if (url.IsNullOrWhiteSpace() == false)
            {
                var umbracoApplicationUrl = url.TrimEnd('/');
                logger.Info(TypeOfApplicationUrlHelper, "ApplicationUrl: {UmbracoAppUrl} (IServerRegistrar)", umbracoApplicationUrl);
                return(umbracoApplicationUrl);
            }

            // else give up...
            return(null);
        }
 public CustomDocumentController(IGlobalSettings globalSettings, IUmbracoContextAccessor umbracoContextAccessor, ServiceContext services, AppCaches appCaches, IProfilingLogger profilingLogger, UmbracoHelper umbracoHelper)
     : base(globalSettings, umbracoContextAccessor, services, appCaches, profilingLogger, umbracoHelper)
 {
 }
Exemplo n.º 30
0
        public static string GetApplicationUrlFromCurrentRequest(HttpRequestBase request, IGlobalSettings globalSettings)
        {
            // if (HTTP and SSL not required) or (HTTPS and SSL required),
            //  use ports from request
            // otherwise,
            //  if non-standard ports used,
            //  user may need to set umbracoApplicationUrl manually per
            //  https://our.umbraco.com/documentation/Using-Umbraco/Config-files/umbracoSettings/#ScheduledTasks
            var port = (request.IsSecureConnection == false && globalSettings.UseHttps == false) ||
                       (request.IsSecureConnection && globalSettings.UseHttps)
                ? ":" + request.ServerVariables["SERVER_PORT"]
                : "";

            var useSsl = globalSettings.UseHttps || port == "443";
            var ssl    = useSsl ? "s" : ""; // force, whatever the first request
            var url    = "http" + ssl + "://" + request.ServerVariables["SERVER_NAME"] + port + IOHelper.ResolveUrl(SystemDirectories.Umbraco);

            return(url.TrimEnd('/'));
        }
Exemplo n.º 31
0
 public DateFormattedUrlProvider(IRequestHandlerSection requestSettings, ILogger logger, IGlobalSettings globalSettings, ISiteDomainHelper siteDomainHelper)
     : base(requestSettings, logger, globalSettings, siteDomainHelper)
 {
 }
 public BatchedDatabaseServerMessenger(
     IRuntimeState runtime, IUmbracoDatabaseFactory databaseFactory, IScopeProvider scopeProvider, ISqlContext sqlContext, IProfilingLogger proflog, IGlobalSettings globalSettings, bool enableDistCalls, DatabaseServerMessengerOptions options)
     : this(runtime, databaseFactory, scopeProvider, sqlContext, proflog, globalSettings, options)
 {
 }
Exemplo n.º 33
0
 public NotificationProcessor(IGlobalSettings globalSettings, IMessageWrapper messageWrapper)
 {
     _globalSettings = globalSettings;
     _messageWrapper = messageWrapper;
     _cancellationTokenSource = new CancellationTokenSource();
 }
 public BatchedDatabaseServerMessenger(
     IRuntimeState runtime, IUmbracoDatabaseFactory databaseFactory, IScopeProvider scopeProvider, ISqlContext sqlContext, IProfilingLogger proflog, IGlobalSettings globalSettings, DatabaseServerMessengerOptions options)
     : base(runtime, scopeProvider, sqlContext, proflog, globalSettings, true, options)
 {
     _databaseFactory = databaseFactory;
 }
Exemplo n.º 35
0
 public TopicService(IGlobalSettings globalSettings)
 {
     _globalSettings = globalSettings;
     Task.Run(() => this.EnsureTopic()).Wait();
 }
Exemplo n.º 36
0
 public MediaTreeController(UmbracoTreeSearcher treeSearcher, IGlobalSettings globalSettings, IUmbracoContextAccessor umbracoContextAccessor, ISqlContext sqlContext, ServiceContext services, AppCaches appCaches, IProfilingLogger logger, IRuntimeState runtimeState, UmbracoHelper umbracoHelper) : base(globalSettings, umbracoContextAccessor, sqlContext, services, appCaches, logger, runtimeState, umbracoHelper)
 {
     _treeSearcher = treeSearcher;
 }