public SmtpService(EntityApp app, SmtpSettings settings) { _app = app; _settings = settings; _app.RegisterService <ISmtpService>(this); _app.RegisterConfig(settings); }
public VitaJwtTokenHandler(EntityApp entityApp, IServiceCollection services, string jwtSecret) { _entityApp = entityApp; _entityApp.RegisterService <IAuthenticationTokenHandler>(this); var secretBytes = Encoding.ASCII.GetBytes(jwtSecret); _jwtKey = new SymmetricSecurityKey(secretBytes); // some cryptic code copied from samples somewhere services.AddAuthentication(x => { x.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme; x.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme; }) .AddJwtBearer(x => { x.Events = new JwtBearerEvents { OnTokenValidated = OnJwtTokenValidated }; x.RequireHttpsMetadata = false; x.SaveToken = true; x.TokenValidationParameters = new TokenValidationParameters { ValidateIssuerSigningKey = true, IssuerSigningKey = _jwtKey, ValidateIssuer = false, ValidateAudience = false }; }); }
public WebCallContextHandler(EntityApp app, WebCallContextHandlerSettings settings) { App = app; Settings = settings ?? new WebCallContextHandlerSettings(); App.RegisterConfig(Settings); _webCallLog = App.GetService<IWebCallLogService>(); _errorLog = App.GetService<IErrorLogService>(); App.RegisterService<IWebCallNotificationService>(this); }
public WebCallContextHandler(EntityApp app, WebCallContextHandlerSettings settings) { App = app; Settings = settings ?? new WebCallContextHandlerSettings(); App.RegisterConfig(Settings); _webCallLog = App.GetService <IWebCallLogService>(); _errorLog = App.GetService <IErrorLogService>(); _sessionService = App.GetService <IUserSessionService>(); App.RegisterService <IWebCallNotificationService>(this); }
public static ILogBatchingService GetCreateLogBatchingService(EntityApp app) { var iServ = (ILogBatchingService)app.GetService(typeof(ILogBatchingService)); if (iServ != null) { return(iServ); } // create and register it var batchingServ = new LogBatchingService(); app.RegisterService <ILogBatchingService>(batchingServ); batchingServ.Init(app); return(batchingServ); }
public static void ConfigureWebApi(HttpConfiguration httpConfiguration, EntityApp app, LogLevel logLevel = LogLevel.Basic, WebHandlerOptions webHandlerOptions = WebHandlerOptions.DefaultDebug, ApiNameMapping nameMapping = ApiNameMapping.Default) { // Logging message handler var webHandlerStt = new WebCallContextHandlerSettings(logLevel, webHandlerOptions); var webContextHandler = new WebCallContextHandler(app, webHandlerStt); httpConfiguration.MessageHandlers.Add(webContextHandler); // Exception handling filter - to handle/save exceptions httpConfiguration.Filters.Add(new ExceptionHandlingFilter()); // Formatters - add formatters with spies, to catch/log deserialization failures httpConfiguration.Formatters.Clear(); httpConfiguration.Formatters.Add(new StreamMediaTypeFormatter("image/jpeg", "image/webp")); //webp is for Chrome var xmlFmter = new XmlMediaTypeFormatter(); httpConfiguration.Formatters.Add(xmlFmter); var jsonFmter = new JsonMediaTypeFormatter(); // add converter that will serialize all enums as strings, not integers jsonFmter.SerializerSettings.Converters.Add(new Newtonsoft.Json.Converters.StringEnumConverter()); jsonFmter.SerializerSettings.ContractResolver = new JsonNameContractResolver(nameMapping); jsonFmter.SerializerSettings.DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Unspecified; httpConfiguration.Formatters.Add(jsonFmter); //Api configuration if (app.ApiConfiguration.ControllerInfos.Count > 0) { ConfigureSlimApiControllers(httpConfiguration, app); } app.RegisterService <IBackgroundTaskService>(new WebBackgroundTaskService(app)); }
public SmtpService(EntityApp app, SmtpSettings settings) { _app = app; _settings = settings; _app.RegisterService<IEmailSendService>(this); _app.RegisterConfig(settings); }
public NotificationService(EntityApp app) { _app = app; _app.RegisterService <INotificationService>(this); }
public AuthorizationService(EntityApp app) { _app = app; _app.RegisterService<IAuthorizationService>(this); _builder = new AuthorityBuilder(_app); }
public DataAccessService(EntityApp app, EntityCache sharedCache = null) { _app = app; _events = new DataSourceEvents(this); app.RegisterService<IDataAccessService>(this); }
public NotificationService(EntityApp app) { _app = app; _app.RegisterService<INotificationService>(this); }
public VitaWebMiddleware(RequestDelegate next, EntityApp app) { _next = next; App = app; App.RegisterService <IWebCallNotificationService>(this); }