private TableRow Row(VerificationRecord record) { var tableRow = new TableRow(); tableRow.Cells.Add(new TableCell()); string tag = _tagger.TagInteraction(record.Interaction); tableRow.Cells.Add(new TableCell( new Italic(new Text(tag)) ).Attribute("class", "table-cell") as TableCell); tableRow.Cells.Add(new TableCell( new Italic(new Text($"{record.Interaction.ConsumerName}::{record.Interaction.ProviderName}")) ).Attribute("class", "table-cell") as TableCell); tableRow.Cells.Add(new TableCell( new Italic(new Text(record.Interaction.RequestPath)) ).Attribute("class", "table-cell") as TableCell); var status = record.Success ? "PASS" : "FAIL"; tableRow.Cells.Add(new TableCell( new Bold(new Text(status)) ).Attribute("class", "table-cell table-cell-" + status.ToLower()) as TableCell); tableRow.Cells.Add(new TableCell( new Text(ParagraphEncode(record.Logs)) ).Attribute("class", "table-cell details-paragraph") as TableCell); return(tableRow); }
public async Task SaveNewRecord(VerificationRecord record) { _dbContext.VerificationRecords.Add(new VerificationRecordEntity { Pseudonym = record.Pseudonym, VerifiedAtTime = record.VerifiedAtTime }); await _dbContext.SaveChangesAsync(); }
public async Task <VerificationResult> Handle(Command request, CancellationToken cancellationToken) { var existingRecords = await _verificationRecordsRepository.RetrieveRecordsForPseudonym(request.Pseudonym, _verificationLimit.RecordsCutoff); var newRecord = new VerificationRecord(request.Pseudonym); var verificationRecords = existingRecords.Concat(new[] { newRecord }); _logger.LogInformation("Creating verified positive result for pin user"); var verificationResult = new VerificationResult(new PositiveTestResult(), verificationRecords, _verificationLimit); await _verificationRecordsRepository.SaveNewRecord(newRecord); return(verificationResult); }
private async Task <User> CreatePositiveUser(PositiveTestResult testResult, Command request) { var userIdClaim = FindUserIdClaim(request.ExternalClaims).ValueOr(() => throw new Exception("Unable to determine user-ID from external claims from provider: " + request.Provider)); var pseudonym = _pseudonymFactory.Create(request.Provider + ":" + userIdClaim.Value); var existingRecords = await _verificationRecordsRepository.RetrieveRecordsForPseudonym(pseudonym); var newRecord = new VerificationRecord(pseudonym); var verificationRecords = existingRecords.Concat(new[] { newRecord }); _logger.LogInformation("Verified positive user created after ID-porten login and MSIS lookup"); var postiveUser = new PositiveUser(request.Provider, userIdClaim.Value, testResult, verificationRecords, _verificationLimit); await _verificationRecordsRepository.SaveNewRecord(newRecord); return(postiveUser); }
public Task SaveNewRecord(VerificationRecord record) { Records.Add(record); return(Task.CompletedTask); }