Ejemplo n.º 1
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public async void ConfigureServices(IServiceCollection services)
        {
            // Add framework services.
            services.AddMvc();
            services.AddSingleton <IBaseDatosServicio, BaseDatosServicio>();
            services.AddSingleton <IAdscSistServicio, AdscSistServicio>();
            services.AddSingleton <IApiServicio, ApiServicio>();
            services.AddResponseCaching();

            services.AddSingleton <IAdscpasswServicio, AdscpasswServicio>();
            await InicializarWebApp.InicializarWeb("SeguridadWebService", new Uri("http://localhost:4000"));

            await InicializarWebApp.InicializarLogEntry("LogWebService", new Uri("http://localhost:4000"));
        }
Ejemplo n.º 2
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public async void ConfigureServices(IServiceCollection services)
        {
            //services.AddIdentity<ApplicationUser,IdentityRole>(options=>
            //{



            //})

            //.AddDefaultTokenProviders();
            // Add framework services.
            services.AddMvc(

                );

            var appSettings = Configuration.GetSection("AppSettings");

            services.AddSingleton <IApiServicio, ApiServicio>();
            services.TryAddSingleton <IHttpContextAccessor, HttpContextAccessor>();

            services.AddAuthorization(options =>
            {
                options.AddPolicy("EstaAutorizado",
                                  policy => policy.Requirements.Add(new RolesRequirement()));
            });

            services.AddSingleton <IAuthorizationHandler, RolesHandler>();
            services.AddTransient <IEmailSender, AuthMessageSender>();
            services.AddTransient <ISmsSender, AuthMessageSender>();

            var ServicioSeguridad           = Configuration.GetSection("ServicioSeguridad").Value;
            var ServiciosLog                = Configuration.GetSection("ServiciosLog").Value;
            var ServicioTalentoHumano       = Configuration.GetSection("ServiciosTalentoHumano").Value;
            var ServiciosRecursosMateriales = Configuration.GetSection("ServiciosRecursosMateriales").Value;

            var HostSeguridad = Configuration.GetSection("HostServicioSeguridad").Value;

            WebApp.BaseAddressWebAppLogin = Configuration.GetSection("HostWebAppLogin").Value;

            await InicializarWebApp.InicializarWeb(ServicioTalentoHumano, new Uri(HostSeguridad));

            await InicializarWebApp.InicializarSeguridad(ServicioSeguridad, new Uri(HostSeguridad));

            await InicializarWebApp.InicializarWebRecursosMateriales(ServiciosRecursosMateriales, new Uri(HostSeguridad));

            await InicializarWebApp.InicializarLogEntry(ServiciosLog, new Uri(HostSeguridad));
        }
Ejemplo n.º 3
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public async void ConfigureServices(IServiceCollection services)
        {
            services.AddIdentity <ApplicationUser, IdentityRole>(options =>
            {
                options.Cookies.ApplicationCookie.LoginPath        = new PathString("/Login/Index");
                options.Cookies.ApplicationCookie.AccessDeniedPath = new PathString("/Login/Index");

                options.Cookies.ApplicationCookie.ExpireTimeSpan = TimeSpan.FromHours(2);
            })

            .AddDefaultTokenProviders();
            // Add framework services.
            services.AddMvc(

                );

            var appSettings = Configuration.GetSection("AppSettings");

            services.AddSingleton <IApiServicio, ApiServicio>();
            services.TryAddSingleton <IHttpContextAccessor, HttpContextAccessor>();

            services.AddAuthorization(options =>
            {
                options.AddPolicy("EstaAutorizado",
                                  policy => policy.Requirements.Add(new RolesRequirement()));
            });

            services.AddSingleton <IAuthorizationHandler, RolesHandler>();
            services.AddTransient <IEmailSender, AuthMessageSender>();
            services.AddTransient <ISmsSender, AuthMessageSender>();

            var ServicioSeguridad           = Configuration.GetSection("ServicioSeguridad").Value;
            var ServiciosLog                = Configuration.GetSection("ServiciosLog").Value;
            var ServicioTalentoHumano       = Configuration.GetSection("ServiciosTalentoHumano").Value;
            var ServiciosRecursosMateriales = Configuration.GetSection("ServiciosRecursosMateriales").Value;

            var HostSeguridad = Configuration.GetSection("HostServicioSeguridad").Value;

            await InicializarWebApp.InicializarWeb(ServicioTalentoHumano, new Uri(HostSeguridad));

            await InicializarWebApp.InicializarSeguridad(ServicioSeguridad, new Uri(HostSeguridad));

            await InicializarWebApp.InicializarWebRecursosMateriales(ServiciosRecursosMateriales, new Uri(HostSeguridad));

            await InicializarWebApp.InicializarLogEntry(ServiciosLog, new Uri(HostSeguridad));
        }
Ejemplo n.º 4
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public async void ConfigureServices(IServiceCollection services)
        {
            // Add framework services.
            services.AddMvc();
            services.AddSingleton <IApiServicio, ApiServicio>();

            var ServicioSeguridad           = Configuration.GetSection("ServicioSeguridad").Value;
            var ServiciosLog                = Configuration.GetSection("ServiciosLog").Value;
            var ServicioTalentoHumano       = Configuration.GetSection("ServiciosTalentoHumano").Value;
            var ServiciosRecursosMateriales = Configuration.GetSection("ServiciosRecursosMateriales").Value;

            var HostSeguridad = Configuration.GetSection("HostServicioSeguridad").Value;
            await InicializarWebApp.InicializarWebRecursosMateriales(ServiciosRecursosMateriales, new Uri(HostSeguridad));

            await InicializarWebApp.InicializarSeguridad(ServicioSeguridad, new Uri(HostSeguridad));

            await InicializarWebApp.InicializarWebTalentoHumano(ServicioTalentoHumano, new Uri(HostSeguridad));

            await InicializarWebApp.InicializarLogEntry(ServiciosLog, new Uri(HostSeguridad));
        }