/// <summary> /// ConfigureServices Services /// </summary> /// <param name="services"></param> /// <param name="configuration"></param> public static void ConfigureServices(IServiceCollection services, IConfiguration configuration) { var logger = new LoggerConfiguration() .MinimumLevel.Debug() .WriteTo.Console(theme: AnsiConsoleTheme.Code) .WriteTo.Seq("http://seq:5341") .CreateLogger(); services.AddTransient(x => logger); var provider = new PostgreSqlProvider(configuration["PostgreSQL:DefaultConnection"]); services.AddTransient <IDbProvider <NpgsqlConnection> >(x => provider); var authServiceRepository = new AuthServiceRepository(provider, logger); services.AddTransient <IAuthServiceRepository>(x => authServiceRepository); var authService = new AuthService(authServiceRepository, logger); services.AddTransient(x => authService); var confidentialClientApplication = ConfidentialClientApplicationBuilder .Create(configuration["MicrosoftAPI:ApiID"]) .WithTenantId(configuration["MicrosoftAPI:TenantId"]) .WithClientSecret(configuration["MicrosoftAPI:ClientSecret"]) .Build(); var authenticationProvider = new ClientCredentialProvider(confidentialClientApplication); var graphServiceClient = new GraphServiceClient(authenticationProvider); services.AddTransient(x => graphServiceClient); var activityFactory = new ActivitiesFactory(graphServiceClient, logger); services.AddTransient(x => activityFactory); var useCaseFactory = new UseCaseFactory(activityFactory, logger); services.AddTransient(x => useCaseFactory); var userService = new UserService(useCaseFactory, logger); services.AddTransient(x => userService); var groupService = new GroupService(useCaseFactory, logger); services.AddTransient(x => groupService); var teamService = new TeamService(useCaseFactory, logger); services.AddTransient(x => teamService); }
public AuthService(AuthServiceRepository authServiceRepository, Logger logger) { _authServiceRepository = authServiceRepository; this.logger = logger; }