Ejemplo n.º 1
0
        /// <summary>
        /// Activates the WorkBench and the middleware of its services previously initiated.
        /// </summary>
        /// <param name="builder">The builder of the core application</param>
        /// <returns>The builder of the core application</returns>
        public static IServiceCollection AddWorkBench(this IServiceCollection service, IConfiguration Configuration, bool hasIdentityServer = false)
        {
            WorkBench.Configuration = Configuration;
            //Add Secrets options
            WorkBench.Configuration = Configuration.UseSecrets();

            service.AddHttpContextAccessor();

            //Inject Swagger (Open API specification) and API Versioning
            WebApiVersion.AddApiVersion(service);
            Swagger.AddSwagger(service);

            //Inject JWT pattern and security
            AuthenticationExtension.AddAuth(service, hasIdentityServer);

            TelemetryExtensions.AddTelemetry(service);

            return(service);
        }