public async Task <IActionResult> Index(IFormCollection form) { UploadLinkModel model = UploadModelFactory.CreateLink(); if (!await this.TryUpdateModelAsync(model)) { return(this.View(model)); } await this.ReserveUploadAsync(model); return(this.View("LinkCreated", model)); }
public async Task <IActionResult> UploadFileHandler(FileIdentifier id) { var file = await this._uploadedFileRepository.GetFileReservation(id); if (file == null) { this.Response.StatusCode = 404 /* Not Found */; return(this.View("UploadLinkExpired")); } // Set-up authentication ClaimsIdentity userIdentity = new ClaimsIdentity(KnownAuthenticationScheme.PassphraseScheme); userIdentity.AddClaims(new[] { new Claim(ClaimTypes.Name, KnownPolicies.Upload, ClaimValueTypes.String, "https://ifs"), new Claim(KnownClaims.RestrictionId, id.ToString(), ClaimValueTypes.String, "https://ifs"), }); ClaimsPrincipal userPrincipal = new ClaimsPrincipal(userIdentity); AuthenticationProperties authenticationOptions = new AuthenticationProperties { AllowRefresh = true, ExpiresUtc = DateTimeOffset.UtcNow.AddMinutes(30), IsPersistent = false }; await this.HttpContext.SignInAsync(KnownAuthenticationScheme.PassphraseScheme, userPrincipal, authenticationOptions); // Create model for upload UploadModel uploadModel = UploadModelFactory.Create(); uploadModel.FileIdentifier = file.Id; uploadModel.Expiration = file.Metadata.Expiration; uploadModel.IsReservation = true; uploadModel.Sender = file.Metadata.Sender; return(this.View("Index", uploadModel)); }
public IActionResult Index() { UploadLinkModel model = UploadModelFactory.CreateLink(); return(this.View(model)); }
public IActionResult Index() { UploadModel uploadModel = UploadModelFactory.Create(); return(this.View(uploadModel)); }