private void BuildSimulator(string keyFramePath, string liveDataFile, string username, string password, string authKeyFile, bool createThread) { //_log.Info("Building live timing simulator..."); IKeyFrame kf = new Simulator.KeyFrame(keyFramePath); IAuthKey ak; if (string.IsNullOrEmpty(username) || string.IsNullOrEmpty(password)) { ak = new AuthorizationKey(authKeyFile); } else { // We can still use this in the sim, albeit a bit cheeky :) ak = new Protocol.AuthorizationKey(username, password); } _handler = new MessageDispatcherImpl(this); MemoryStream memStream = new MemoryStream(MEMSTREAM_SIZE); _runtime = new Runtime.Runtime(memStream, ak, kf, _handler); // Create network component that drives the Runtime with data. CreateDriver(liveDataFile, kf, memStream); if (createThread) { //_log.Info("Creating child thread to Run simulator"); Start(); } }
private async Task SeedAsync() { var key = "95c9d5ad-bb45-480c-8568-44906592f75b"; var salt = HashService.GetSalt(); var apiKeyHash = HashService.CalculateHash(salt, key); var authenticationKey = new AuthorizationKey(salt, apiKeyHash); await DbContext.AuthorizationKeys.AddAsync(authenticationKey); await DbContext.SaveChangesAsync(); Log.Information("Database seeded successfuly"); }
public void OnAuthorization(AuthorizationFilterContext context) { if (!context.HttpContext.Request.Headers.TryGetValue("", out var AuthorizationKey)) { throw new UnauthorizedAccessException(); } var authorizationKey = _config["AuthorizationKey"]; if (!AuthorizationKey.Equals(authorizationKey)) { throw new UnauthorizedAccessException(); } }
public Vgp() { _TargetFile = new TargetFile(); _Directorio = _TargetFile._Directorio; _Archivo = _TargetFile._Archivo; _AuthorizationKey = new AuthorizationKey(); _Cadena = _AuthorizationKey._Credentialbd._Sgrd._Cadena; _Ip = _AuthorizationKey._Credentialbd._Sgrd._Ip; _Sid = _AuthorizationKey._Credentialbd._Sgrd._Sid; _LogReporteDian = new LogReporteDian(); _IcpdbInfoDian = new IcpdbInfoDian(); _InformacionDian = new InformacionDian(); _Upload = new Upload(); _HttpWebRequestFunction = new HttpWebRequestFunction(); }
public MobileApiActionFilter(IOptions <AuthorizationKey> options) { _authorizationKey = options.Value; }
public async Task SetApiKeyAsync(AuthorizationKey authKey) { _dbContext.AuthorizationKeys.Update(authKey); await _dbContext.SaveChangesAsync(); }