public AccountController( DocFlowCotext context, IAuthentication authentication ) : base(context) { _authentication = authentication; }
public Authentication(AzureADService azureADService, JwtService jwtService, DocFlowCotext docFlowContext) { postBody = postBody + $"&resource={azureADService.Resource}&client_id={azureADService.ClientId}&client_secret={azureADService.AppKey}"; tokenEndpoint = azureADService.TokenEndpoint; validIssuer = jwtService.ValidIssuer; validAudience = jwtService.ValidAudience; issuerSigningKey = jwtService.IssuerSigningKey; _docFlowContext = docFlowContext; }
public ReportController( DocFlowCotext context, IReportService reportService, IDocumentService documentService, IGraphServiceFiles graphServiceFiles ) : base(context) { _reportService = reportService; _documentService = documentService; _graphServiceFiles = graphServiceFiles; }
public DocumentController( DocFlowCotext context, IDocumentService documentService, IGraphServiceFiles graphServiceFiles, IReportService reportService, IDigitalSignature digitalSignature ) : base(context) { _reportService = reportService; _documentService = documentService; _graphServiceFiles = graphServiceFiles; _digitalSignature = digitalSignature; }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddDbContext<DocFlowCotext>( options => options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection"))); // Auto Mapper Configurations MapperConfiguration mappingConfig = new MapperConfiguration(mc => { mc.AddProfile(new MappingProfile()); }); IMapper mapper = mappingConfig.CreateMapper(); services.AddSingleton(mapper); services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1); services.AddSingleton(s => GetAzureADService()); JwtService jwtService = GetJwtService(); services.AddScoped<IDocumentService, DocumentService>(); services.AddScoped<IGraphServiceFiles, GraphServiceFiles>(); services.AddScoped<IReportService, ReportService>(); ServiceProvider serviceProvider = services.BuildServiceProvider(); DocFlowCotext contextService = serviceProvider.GetService<DocFlowCotext>(); IReportService reportService = (IReportService)serviceProvider.GetService(typeof(IReportService)); IDocumentService documentService = (IDocumentService)serviceProvider.GetService(typeof(IDocumentService)); services.AddTransient<IAuthentication>(s => new Authentication(GetAzureADService(), jwtService, contextService)); services.AddTransient<IDigitalSignature>(d => new DigitalSignature(GetDigitalSignatureCertificate(), documentService, reportService)); services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme).AddJwtBearer(options => { options.TokenValidationParameters = new TokenValidationParameters { ValidateIssuer = true, ValidateAudience = true, ValidateIssuerSigningKey = true, ValidateLifetime = true, ValidIssuer = jwtService.ValidIssuer, ValidAudience = jwtService.ValidAudience, IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(jwtService.IssuerSigningKey)) }; }); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, DocFlowCotext context) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseHsts(); } app.UseHttpsRedirection(); app.UseAuthentication(); app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller}/{action}/{id?}"); }); DbInitializer.Initialize(context); }
public DocumentService( DocFlowCotext context ) { _context = context; }
public BaseController( DocFlowCotext context ) { _context = context; }
public ReportService(DocFlowCotext docFlowContext, IMapper mapper) { _docFlowContext = docFlowContext; _mapper = mapper; }