public static void AddTravelyIdentityService(this IServiceCollection services, IWebHostEnvironment env)
        {
            services
            .AddScoped <IResourceOwnerPasswordValidator, ResourceOwnerPasswordValidator>()
            .AddScoped <IProfileService, ProfileService>();
            //.AddScoped<IExtensionGrantValidator, DelegationGrantValidator>();

            services.AddTransient <IPasswordHasher <User>, PasswordHasher <User> >();

            services
            .AddIdentityServer()
            .AddDeveloperSigningCredential()
            //.AddSigningCredential()
            .AddCorsPolicyService <CorsPolicyService>()
            .AddPersistedGrantStore <PersistedGrantStore>()
            .AddInMemoryApiResources(AuthConfigs.GetApiResources())
            .AddInMemoryClients(AuthConfigs.GetClients(env))
            .AddInMemoryApiScopes(AuthConfigs.GetScopes());

            services.AddAuthorization(options =>
            {
                options.AddPolicy("admin", policy => policy.RequireClaim("Admin"));
            })
            .AddAuthentication(options =>
            {
                options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;
                options.DefaultChallengeScheme    = JwtBearerDefaults.AuthenticationScheme;
            }).AddLocalApi(JwtBearerDefaults.AuthenticationScheme, options =>
            {
                options.ExpectedScope = null;
            });

            services.AddScoped <IEmailTokenService, EmailTokenService>();
        }
        public static void AddTravelyIdentityService(this IServiceCollection services)
        {
            services.AddScoped <IResourceOwnerPasswordValidator, ResourceOwnerPasswordValidator>()
            .AddScoped <IProfileService, ProfileService>();
            //.AddScoped<IExtensionGrantValidator, DelegationGrantValidator>();
            services.AddTransient <IPasswordHasher <User>, PasswordHasher <User> >();

            services.AddIdentityServer()
            .AddDeveloperSigningCredential()
            //.AddSigningCredential()
            .AddPersistedGrantStore <PersistedGrantStore>()
            .AddInMemoryApiResources(AuthConfigs.GetApiResources())
            .AddInMemoryClients(AuthConfigs.GetClients())
            .AddInMemoryApiScopes(AuthConfigs.GetScopes())
            ;
        }