using xIds.Providers; using xIds.Interfaces; using xCommons.Extensions; using xExceptions.Constants; using xIdentityService.Interfaces; using Microsoft.Extensions.DependencyInjection; namespace xIds.Extensions { public static class IdentityExtensions { /// /// Register IdentityManager /// /// public static void AddXIdentityManager(this IServiceCollection source) { source.AddScoped(); } /// /// Register IdentityMessage Provider /// /// public static void AddXIdentityMessageProvider( this IServiceCollection source ) { source.AddScoped(); } /// /// Register Authorization Provider ... /// /// public static void AddXAuthorizationProvider( this IServiceCollection source ) { // // Validate Requirements ... var roles = source.GetRegisteredService(); var scopes = source.GetRegisteredService(); var policies = source.GetRegisteredService(); var cache = source.GetRegisteredService(); var resolver = source.GetRegisteredService(); // var isInvalid = roles.IsNull() || cache.IsNull() || scopes.IsNull() || policies.IsNull() || resolver.IsNull(); if (isInvalid) { XException.InvalidConfiguration.Throw(); } // source.AddScoped(); } } }