public static IServiceCollection ConfigurationCORSService(this IServiceCollection services)
        {
            // Get App Settings for Identity Server Url
            AppMgmtAppSettings appSettings = services.BuildServiceProvider().GetRequiredService <IOptions <AppMgmtAppSettings> >().Value;

            // System Cors Dependency for Cross Origin
            services.AddCors(o => o.AddPolicy("AllowSpecificOrigin",
                                              builder => {
                builder.SetIsOriginAllowedToAllowWildcardSubdomains().WithOrigins(appSettings.CrossOriginsUrls).AllowAnyMethod().WithExposedHeaders("content-disposition").AllowAnyHeader().AllowCredentials().SetPreflightMaxAge(TimeSpan.FromSeconds(86800));
            }));


            return(services);
        }
        public static IServiceCollection ConfigureAuthenticationService(this IServiceCollection services, IConfiguration configuration)
        {
            // Get App Settings for Identity Server Url
            AppMgmtAppSettings appSettings = services.BuildServiceProvider().GetRequiredService <IOptions <AppMgmtAppSettings> >().Value;

            // Identity Server Url
            services.AddAuthentication(IdentityServerAuthenticationDefaults.AuthenticationScheme)
            .AddIdentityServerAuthentication(options => {
                options.Authority            = appSettings.IdentityServerUrl;
                options.RequireHttpsMetadata = false;
                options.ApiName = appSettings.AppName;
            });

            return(services);
        }