/// <summary> /// Configures the auth services for json web token bearer. /// </summary> /// <param name="services">The injected services provider.</param> public void ConfigureAuthServicesForJwtBearer(IServiceCollection services) { IAuditLogger auditLogger = services.BuildServiceProvider().GetService <IAuditLogger>(); bool debugEnabled = this.environment.IsDevelopment() || this.configuration.GetValue <bool>("EnableDebug", true); this.Logger.LogDebug($"Debug configuration is {debugEnabled}"); // Displays sensitive data from the jwt if the environment is development only IdentityModelEventSource.ShowPII = debugEnabled; services.AddAuthentication(options => { options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme; options.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme; }).AddJwtBearer(options => { options.SaveToken = true; options.RequireHttpsMetadata = true; options.IncludeErrorDetails = true; this.configuration.GetSection("OpenIdConnect").Bind(options); options.TokenValidationParameters = new TokenValidationParameters() { ValidateIssuerSigningKey = true, ValidateAudience = true, ValidateIssuer = true, }; options.Events = new JwtBearerEvents() { OnAuthenticationFailed = (ctx) => { return(this.OnAuthenticationFailed(ctx, auditLogger)); }, }; }); }
public AdminService( [KeyFilter(Filenames.ManualChangeLog)] IAuditLogger manualChangeLog, [KeyFilter(Filenames.BadSicLog)] IAuditLogger badSicLog, [KeyFilter(Filenames.RegistrationLog)] IAuditLogger registrationLog, IShortCodesRepository shortCodesRepository, IOrganisationBusinessLogic organisationBusinessLogic, ISearchBusinessLogic searchBusinessLogic, ISubmissionBusinessLogic submissionBusinessLogic, IUserRepository userRepository, [KeyFilter(QueueNames.ExecuteWebJob)] IQueue executeWebjobQueue, [KeyFilter("Private")] IPagedRepository <EmployerRecord> privateSectorRepository, [KeyFilter("Public")] IPagedRepository <EmployerRecord> publicSectorRepository, ISearchRepository <EmployerSearchModel> employerSearchRepository, ISearchRepository <SicCodeSearchModel> sicCodeSearchRepository, ISharedBusinessLogic sharedBusinessLogic ) { ManualChangeLog = manualChangeLog; BadSicLog = badSicLog; RegistrationLog = registrationLog; ShortCodesRepository = shortCodesRepository; OrganisationBusinessLogic = organisationBusinessLogic; SearchBusinessLogic = searchBusinessLogic; SubmissionBusinessLogic = submissionBusinessLogic; UserRepository = userRepository; ExecuteWebjobQueue = executeWebjobQueue; PrivateSectorRepository = privateSectorRepository; PublicSectorRepository = publicSectorRepository; EmployerSearchRepository = employerSearchRepository; SicCodeSearchRepository = sicCodeSearchRepository; SharedBusinessLogic = sharedBusinessLogic; }
/// <summary> /// Handles authentication failures. /// </summary> /// <param name="context">The authentication failed context.</param> /// <param name="auditLogger">The audit logger provider.</param> /// <returns>An async task.</returns> private Task OnAuthenticationFailed(AuthenticationFailedContext context, IAuditLogger auditLogger) { this.Logger.LogDebug("OnAuthenticationFailed..."); AuditEvent auditEvent = new AuditEvent(); auditEvent.AuditEventDateTime = DateTime.UtcNow; auditEvent.TransactionDuration = 0; // There's not a way to calculate the duration here. auditLogger.PopulateWithHttpContext(context.HttpContext, auditEvent); auditEvent.TransactionResultCode = AuditTransactionResult.Unauthorized; auditEvent.CreatedBy = nameof(StartupConfiguration); auditEvent.CreatedDateTime = DateTime.UtcNow; auditLogger.WriteAuditEvent(auditEvent); context.Response.StatusCode = (int)HttpStatusCode.Unauthorized; context.Response.ContentType = "application/json"; return(context.Response.WriteAsync(JsonConvert.SerializeObject(new { State = "AuthenticationFailed", Message = context.Exception.ToString(), }))); }
public PostcodeFirstController(IDOSBuilder dosBuilder, IAuditLogger auditLogger, IPostCodeAllowedValidator postCodeAllowedValidator, IViewRouter viewRouter) { _dosBuilder = dosBuilder; _auditLogger = auditLogger; _postCodeAllowedValidator = postCodeAllowedValidator; _viewRouter = viewRouter; }
public RegistrationService( [KeyFilter(Filenames.BadSicLog)] IAuditLogger badSicLog, [KeyFilter(Filenames.RegistrationLog)] IAuditLogger registrationLog, IRegistrationBusinessLogic registrationBusinessLogic, IScopeBusinessLogic scopeBL, IOrganisationBusinessLogic orgBL, ISharedBusinessLogic sharedBusinessLogic, ISearchBusinessLogic searchBusinessLogic, IUserRepository userRepository, IPinInThePostService pinInThePostService, IPostcodeChecker postcodeChecker, [KeyFilter("Private")] IPagedRepository <EmployerRecord> privateSectorRepository, [KeyFilter("Public")] IPagedRepository <EmployerRecord> publicSectorRepository ) { RegistrationBusinessLogic = registrationBusinessLogic; BadSicLog = badSicLog; RegistrationLog = registrationLog; ScopeBusinessLogic = scopeBL; OrganisationBusinessLogic = orgBL; SharedBusinessLogic = sharedBusinessLogic; SearchBusinessLogic = searchBusinessLogic; PrivateSectorRepository = privateSectorRepository; PublicSectorRepository = publicSectorRepository; UserRepository = userRepository; PinInThePostService = pinInThePostService; PostcodeChecker = postcodeChecker; }
public ScriptManager(EphItContext dbContext, IEphItUser ephItUser, IUserAuthorization userAuth, IAuditLogger auditLogger) { _dbContext = dbContext; _ephItUser = ephItUser; _userAuth = userAuth; _auditLogger = auditLogger; }
public DecryptAesEntryWorkflowBuilder() { _segmentEncryptionAlgo = new AesSegmentEncryptionAlgo(new AesAlgo()); _keyLoader = LoadKeyFromXmlFileFactory.GetAesKeyLoader(); _datLoader = DatFromXmlFileFactory.GetDatLoader(); _auditLogger = new NullAuditLogger <AesKey, DecryptEntryWorkflowOptions>(); }
public PersonalDetailsController(IAuditLogger auditLogger, ILocationResultBuilder locationResultBuilder, IEmailCollectionFeature emailCollectionFeature) { _auditLogger = auditLogger; _locationResultBuilder = locationResultBuilder; _emailCollectionFeature = emailCollectionFeature; }
public Functions( StorageOptions storageOptions, IEventLogger customLogger, [KeyFilter(Filenames.BadSicLog)] IAuditLogger badSicLog, [KeyFilter(Filenames.ManualChangeLog)] IAuditLogger manualChangeLog, IMessenger messenger, ISharedBusinessLogic sharedBusinessLogic, ISearchRepository <EmployerSearchModel> employerSearchRepository, ISearchRepository <SicCodeSearchModel> sicCodeSearchRepository, ISubmissionBusinessLogic submissionBusinessLogic, IOrganisationBusinessLogic organisationBusinessLogic, ISearchBusinessLogic searchBusinessLogic, IGovNotifyAPI govNotifyApi, UpdateFromCompaniesHouseService updateFromCompaniesHouseService, IAuthorisationBusinessLogic authorisationBusinessLogic) { _StorageOptions = storageOptions; _CustomLogger = customLogger; _BadSicLog = badSicLog; _ManualChangeLog = manualChangeLog; _Messenger = messenger; _SharedBusinessLogic = sharedBusinessLogic; _EmployerSearchRepository = employerSearchRepository; _SicCodeSearchRepository = sicCodeSearchRepository; _SubmissionBusinessLogic = submissionBusinessLogic; _OrganisationBusinessLogic = organisationBusinessLogic; SearchBusinessLogic = searchBusinessLogic; _updateFromCompaniesHouseService = updateFromCompaniesHouseService; _authorisationBusinessLogic = authorisationBusinessLogic; this.govNotifyApi = govNotifyApi; }
public IDecryptRsaEntryWorkflowBuilder WithAuditLogger(IAuditLogger <RsaKey, DecryptEntryWorkflowOptions> auditLogger) { Contract.Requires <ArgumentNullException>(auditLogger != null, "auditLogger"); Contract.Ensures(Contract.Result <IDecryptRsaEntryWorkflowBuilder>() != null); return(default(IDecryptRsaEntryWorkflowBuilder)); }
public UnitOfWorkTests() { context = new TestingContext(); logger = Substitute.For <IAuditLogger>(); model = ObjectsFactory.CreateTestModel(); unitOfWork = new UnitOfWork(context, logger); }
/// <summary> /// Initializes a new instance of the <see cref="UnitOfWork"/> class. /// </summary> /// <param name="dbContext">The database context.</param> /// <param name="serviceProvider">The service provider.</param> /// <param name="auditLoggerService">The audit logger service.</param> public UnitOfWork(DbContext dbContext, IServiceProvider serviceProvider, IAuditLogger auditLoggerService) { _serviceProvider = serviceProvider; _dbContext = dbContext; Repositories = new Dictionary <Type, object>(); auditLogger = auditLoggerService; }
public SubmissionBusinessLogic( ISharedBusinessLogic sharedBusinessLogic, [KeyFilter(Filenames.SubmissionLog)] IAuditLogger submissionLog) { _sharedBusinessLogic = sharedBusinessLogic; SubmissionLog = submissionLog; }
public void SetUp() { iAuditLogger = Substitute.For <IAuditLogger>(); sut = new Bank(iAuditLogger); acc = new Account { Name = "Emil", Balance = 0, Number = "1" }; }
public OrdersController(IPaymentService paymentService, IShippingService shippingService, IAuditLogger auditLogger) { _paymentService = paymentService; _shippingService = shippingService; _auditLogger = auditLogger; }
public UnitOfWorkTests() { context = new TestingContext(); logger = Substitute.For <IAuditLogger>(); unitOfWork = new UnitOfWork(context, logger); context.Set <TestModel>().RemoveRange(context.Set <TestModel>()); context.SaveChanges(); }
public UnitOfWorkTests() { context = new TestingContext(); model = ObjectFactory.CreateRole(); logger = Substitute.For <IAuditLogger>(); unitOfWork = new UnitOfWork(context, logger); context.DropData(); }
public UnitOfWorkTests() { context = new TestingContext(); model = ObjectFactory.CreateRole(); logger = Substitute.For<IAuditLogger>(); unitOfWork = new UnitOfWork(context, logger); context.DropData(); }
public JustToBeSafeFirstViewModelBuilder(ILoggingRestClient restClient, IConfiguration configuration, IMappingEngine mappingEngine, IKeywordCollector keywordCollector, IUserZoomDataBuilder userZoomDataBuilder, IAuditLogger auditLogger) { _restClient = restClient; _configuration = configuration; _mappingEngine = mappingEngine; _keywordCollector = keywordCollector; _userZoomDataBuilder = userZoomDataBuilder; _auditLogger = auditLogger; }
public UnitOfWorkTests() { context = new TestingContext(); logger = Substitute.For<IAuditLogger>(); unitOfWork = new UnitOfWork(context, logger); context.Set<TestModel>().RemoveRange(context.Set<TestModel>()); context.SaveChanges(); }
public SmtpEmailProvider(IEmailTemplateRepository emailTemplateRepo, SmtpEmailOptions smtpEmailOptions, SharedOptions sharedOptions, ILogger <SmtpEmailProvider> logger, [KeyFilter(Filenames.EmailSendLog)] IAuditLogger emailSendLog) : base(sharedOptions, emailTemplateRepo, logger, emailSendLog) { Options = smtpEmailOptions ?? throw new ArgumentNullException(nameof(smtpEmailOptions)); //TODO ensure smtp config is present (when enabled) }
public BookingsController(IConfiguration config, IFacilityRepository facilityRepository, IVenueRepository venueRepository, ISportRepository sportRepository, IBookingRepository bookingRepository, IApiClient client, IAuditLogger auditLogger) { AppConfig = config.GetSection("booking_facilities"); this.venueRepository = venueRepository; this.facilityRepository = facilityRepository; this.sportRepository = sportRepository; this.bookingRepository = bookingRepository; apiClient = client; this.auditLogger = auditLogger; }
public UnitOfWorkTests() { context = new TestingContext(); model = ObjectFactory.CreateTestModel(); logger = Substitute.For <IAuditLogger>(); unitOfWork = new UnitOfWork(context, logger); context.Set <TestModel>().RemoveRange(context.Set <TestModel>()); context.DropData(); }
public SmartOnFhirAuditLoggingFilterAttribute(string action, IAuditLogger auditLogger, IFhirRequestContextAccessor fhirRequestContextAccessor) { EnsureArg.IsNotNullOrWhiteSpace(action, nameof(action)); EnsureArg.IsNotNull(auditLogger, nameof(auditLogger)); EnsureArg.IsNotNull(fhirRequestContextAccessor, nameof(fhirRequestContextAccessor)); _action = action; _auditLogger = auditLogger; _fhirRequestContextAccessor = fhirRequestContextAccessor; }
protected DecryptEntryWorkflow(IDatLoader <TDatLoaderOptions> datLoader, EntriesDecrypter <TKey> entriesDecrypter, IAuditLogger <TKey, TWorkflowOptions> auditLogger) { Contract.Requires <ArgumentNullException>(datLoader != null, "datLoader"); Contract.Requires <ArgumentNullException>(entriesDecrypter != null, "encryptWorkflow"); Contract.Requires <ArgumentNullException>(auditLogger != null, "auditLogger"); // _datLoader = datLoader; _entriesDecrypter = entriesDecrypter; _auditLogger = auditLogger; }
public OutcomeController(IOutcomeViewModelBuilder outcomeViewModelBuilder, IDOSBuilder dosBuilder, ISurgeryBuilder surgeryBuilder, ILocationResultBuilder locationResultBuilder, IAuditLogger auditLogger, Presentation.Configuration.IConfiguration configuration, IPostCodeAllowedValidator postCodeAllowedValidator) { _outcomeViewModelBuilder = outcomeViewModelBuilder; _dosBuilder = dosBuilder; _surgeryBuilder = surgeryBuilder; _locationResultBuilder = locationResultBuilder; _auditLogger = auditLogger; _configuration = configuration; _postCodeAllowedValidator = postCodeAllowedValidator; }
public BaseEmailProvider( SharedOptions sharedOptions, IEmailTemplateRepository emailTemplateRepo, ILogger logger, [KeyFilter(Filenames.EmailSendLog)] IAuditLogger emailSendLog) { EmailTemplateRepo = emailTemplateRepo ?? throw new ArgumentNullException(nameof(emailTemplateRepo)); Logger = logger ?? throw new ArgumentNullException(nameof(logger)); EmailSendLog = emailSendLog ?? throw new ArgumentNullException(nameof(emailSendLog)); SharedOptions = sharedOptions ?? throw new ArgumentNullException(nameof(sharedOptions)); }
public void SetUp() { _iAuditLogger = Substitute.For <IAuditLogger>(); _account = new Account { Name = "Ali", Number = "1", Balance = 0 }; sut = new Bank(_iAuditLogger); }
public OrderCreator(IEnumerable <OrderDataHandler> orderDataHandlers, PublicBillingApiProxy billingApi, IAuditLogger auditLogger = null) : base(billingApi) { if (orderDataHandlers == null) { throw new ArgumentNullException("orderDataHandlers"); } this.orderDataHandlers = orderDataHandlers; this.auditLogger = auditLogger; }
public OrderCreator(IEnumerable<OrderDataHandler> orderDataHandlers, PublicBillingApiProxy billingApi, IAuditLogger auditLogger = null) : base(billingApi) { if (orderDataHandlers == null) { throw new ArgumentNullException("orderDataHandlers"); } this.orderDataHandlers = orderDataHandlers; this.auditLogger = auditLogger; }
public OutcomeViewModelBuilder(ICareAdviceBuilder careAdviceBuilder, IRestfulHelper restfulHelper, IConfiguration configuration, IMappingEngine mappingEngine, IKeywordCollector keywordCollector, IJourneyHistoryWrangler journeyHistoryWrangler, ISurveyLinkViewModelBuilder surveyLinkViewModelBuilder, IAuditLogger auditLogger) { _careAdviceBuilder = careAdviceBuilder; _restfulHelper = restfulHelper; _configuration = configuration; _mappingEngine = mappingEngine; _keywordCollector = keywordCollector; _journeyHistoryWrangler = journeyHistoryWrangler; _surveyLinkViewModelBuilder = surveyLinkViewModelBuilder; _auditLogger = auditLogger; }
public FacilitiesController(IFacilityRepository facilityRepository, IVenueRepository venueRepository, ISportRepository sportRepository, IBookingRepository bookingRepository, IAuditLogger auditLogger) { this.facilityRepository = facilityRepository; this.venueRepository = venueRepository; this.sportRepository = sportRepository; this.bookingRepository = bookingRepository; this.auditLogger = auditLogger; }
public SearchController( IConfiguration configuration, IUserZoomDataBuilder userZoomDataBuilder, ILoggingRestClient restClientBusinessApi, IAuditLogger auditLogger ) { _configuration = configuration; _userZoomDataBuilder = userZoomDataBuilder; _restClientBusinessApi = restClientBusinessApi; _auditLogger = auditLogger; }
public EventListener(IAuditLogger logger) { _logger = logger; }
public SimpleOrderCreator(IEnumerable<OrderDataHandler> orderDataHandlers, PublicBillingApiProxy billingApi, IAuditLogger auditLogger = null) : base(orderDataHandlers, billingApi, auditLogger) { }