/// <summary> /// Loads stored CM's into provided collection /// Called by LoadData() during GUI setup /// </summary> /// <param name="cmCollection">The collection to load</param> /// <param name="hostType">The type of host from which to fetch CM's</param> internal void LoadCmForSwap(ICollection <VibesCm> cmCollection, HostTypes hostType, int hostId = 0) { // CmsDisplay<Host>, clear before populating cmCollection.Clear(); using (DataContext context = new DataContext()) { if (context.EnvironmentHosts.Any(h => h.HostType == hostType)) { // HostId sent but not found, return if (hostId != 0 && !context.EnvironmentHosts.Any(h => h.Id == hostId)) { return; } // Find any configured host(s) in database where the hostid is the same var hosts = hostId != 0 ? context.EnvironmentHosts.Where(h => h.Id == hostId).OrderBy(h => h.Name) : context.EnvironmentHosts.Where(h => h.HostType == hostType).OrderBy(h => h.Name); // Load all CM's for this host foreach (VibesHost host in hosts) { foreach (VibesCm cm in context.HostCms.Where(c => c.VibesHostId == host.Id).Include(c => c.DeploymentProperties).Include(c => c.VibesHost).OrderBy(c => c.CmResourceName)) { var newCm = cm.DeepCopy(); newCm.PropertyChanged += new PropertyChangedEventHandler(PersistTargetChanges); foreach (DeploymentProperty prop in newCm.DeploymentProperties) { prop.PropertyChanged += new PropertyChangedEventHandler(PersistTargetChanges); } cmCollection.Add(newCm); } } } } }
private static void SetupLogging(HttpApplication application, HostTypes hostType) { switch (hostType) { case HostTypes.NotSet: //we do not set up the logging break; case HostTypes.LocalHost: //LocalHost uses WebWiz setup for log4Net case HostTypes.WebWiz: //We set up the log4net settings from a local file and then assign the logger to GenericServices.GenericLoggerFactory var log4NetPath = application.Server.MapPath(WebWizLog4NetRelPath); log4net.Config.XmlConfigurator.ConfigureAndWatch(new System.IO.FileInfo(log4NetPath)); GenericLibsBaseConfig.SetLoggerMethod = name => new Log4NetGenericLogger(name); break; case HostTypes.Azure: //we use the TraceGenericLogger when in Azure GenericLibsBaseConfig.SetLoggerMethod = name => new TraceGenericLogger(name); break; default: throw new ArgumentOutOfRangeException("hostType"); } GenericLibsBaseConfig.GetLogger("LoggerSetup").Info("We have just assegned a logger."); }
public static int getListenerPort(HostTypes hostType) { if (hostType == HostTypes.Cicero_Client) return 39721; if (hostType == HostTypes.Atticus_Server) return 39722; throw new Exception("Unknown host type."); }
/// <summary> /// Configure OWIN to use OpenIdConnect /// </summary> /// <param name="app"></param> public static void Configuration(IAppBuilder app) { HostType = DecodeHostType(Settings.Default.HostTypeString); //WebWiz does not allow drop/create database var canDropCreateDatabase = HostType != HostTypes.WebWiz; SetupLogging(HostType); //This runs the ServiceLayer initialise, whoes job it is to initialise any of the lower layers //NOTE: This MUST to come before the setup of the DI because it relies on the configInfo being set up ServiceLayerInitialise.InitialiseThis(HostType == HostTypes.Azure, canDropCreateDatabase); //This sets up the Autofac container for all levels in the program var container = AutofacDi.SetupDependency(); //// Set the dependency resolver for MVC. var mvcResolver = new AutofacDependencyResolver(container); DependencyResolver.SetResolver(mvcResolver); var service = container.Resolve <IListService>(); MailAuthorize.SetService(service); app.SetDefaultSignInAsAuthenticationType(CookieAuthenticationDefaults.AuthenticationType); app.UseCookieAuthentication(new CookieAuthenticationOptions()); app.UseOpenIdConnectAuthentication( new OpenIdConnectAuthenticationOptions { // Sets the ClientId, authority, RedirectUri as obtained from web.config ClientId = clientId, Authority = authority, RedirectUri = redirectUri, // PostLogoutRedirectUri is the page that users will be redirected to after sign-out. In this case, it is using the home page PostLogoutRedirectUri = redirectUri, Scope = OpenIdConnectScope.OpenIdProfile, // ResponseType is set to request the id_token - which contains basic information about the signed-in user ResponseType = OpenIdConnectResponseType.IdToken, // ValidateIssuer set to false to allow personal and work accounts from any organization to sign in to your application // To only allow users from a single organizations, set ValidateIssuer to true and 'tenant' setting in web.config to the tenant name // To allow users from only a list of specific organizations, set ValidateIssuer to true and use ValidIssuers parameter TokenValidationParameters = new TokenValidationParameters() { ValidateIssuer = false // This is a simplification }, // OpenIdConnectAuthenticationNotifications configures OWIN to send notification of failed authentications to OnAuthenticationFailed method Notifications = new OpenIdConnectAuthenticationNotifications { AuthenticationFailed = OnAuthenticationFailed, //RedirectToIdentityProvider = OnRedirectToIdentityProvider, SecurityTokenValidated = OnSecurityTokenValidated, } } ); }
public HttpPackage() { PackageId = "http"; HostObjects.Add(new HostObject { Name = "http", Target = new NodeHttp() }); HostTypes.Add(new HostType { Name = "Buffer", Type = typeof(NodeBuffer) }); }
public static int getListenerPort(HostTypes hostType) { if (hostType == HostTypes.Cicero_Client) { return(39721); } if (hostType == HostTypes.Atticus_Server) { return(39722); } throw new Exception("Unknown host type."); }
/// <summary> /// This should be called at Startup /// </summary> public static void InitialiseThis(HttpApplication application) { HostType = DecodeHostType(Settings.Default.HostTypeString); //WebWiz does not allow drop/create database var canDropCreateDatabase = HostType != HostTypes.WebWiz; SetupLogging(application, HostType); //This runs the ServiceLayer initialise, whoes job it is to initialise any of the lower layers //NOTE: This MUST to come before the setup of the DI because it relies on the configInfo being set up ServiceLayerInitialise.InitialiseThis(HostType == HostTypes.Azure, canDropCreateDatabase); //This sets up the Autofac container for all levels in the program var container = AutofacDi.SetupDependency(); //// Set the dependency resolver for MVC. var mvcResolver = new AutofacDependencyResolver(container); DependencyResolver.SetResolver(mvcResolver); }
private static void SetupLogging(HostTypes hostType) { switch (hostType) { case HostTypes.NotSet: //we do not set up the logging break; case HostTypes.LocalHost: case HostTypes.WebWiz: case HostTypes.Azure: //we use the TraceGenericLogger when in Azure GenericLibsBaseConfig.SetLoggerMethod = name => new TraceGenericLogger(name); break; default: throw new ArgumentOutOfRangeException("hostType"); } }
/// <summary> /// This should be called at Startup /// </summary> public static void InitialiseThis(HttpApplication application) { HostType = DecodeHostType(Settings.Default.HostTypeString); //WebWiz does not allow drop/create database var canDropCreateDatabase = HostType != HostTypes.WebWiz; SetupLogging(application, HostType); //This runs the ServiceLayer initialise, whoes job it is to initialise any of the lower layers //NOTE: This MUST to come before the setup of the DI because it relies on the configInfo being set up ServiceLayerInitialise.InitialiseThis(HostType == HostTypes.Azure, canDropCreateDatabase); //This sets up the Autofac container for all levels in the program var container = AutofacDi.SetupDependency(); //// Set the dependency resolver for MVC. var mvcResolver = new AutofacDependencyResolver(container); DependencyResolver.SetResolver(mvcResolver); }
private static void SetupLogging(HttpApplication application, HostTypes hostType) { switch (hostType) { case HostTypes.NotSet: //we do not set up the logging break; case HostTypes.LocalHost: //LocalHost uses WebWiz setup for log4Net case HostTypes.WebWiz: //We set up the log4net settings from a local file and then assign the logger to GenericServices.GenericLoggerFactory var log4NetPath = application.Server.MapPath(WebWizLog4NetRelPath); log4net.Config.XmlConfigurator.ConfigureAndWatch(new System.IO.FileInfo(log4NetPath)); GenericLibsBaseConfig.SetLoggerMethod = name => new Log4NetGenericLogger(name); break; case HostTypes.Azure: //we use the TraceGenericLogger when in Azure GenericLibsBaseConfig.SetLoggerMethod = name => new TraceGenericLogger(name); break; default: throw new ArgumentOutOfRangeException("hostType"); } GenericLibsBaseConfig.GetLogger("LoggerSetup").Info("We have just assegned a logger."); }
public HostTypesCreateOrUpdateCommand(HostTypes ent) { this.ent = ent; }