public bool CheckToken(string token) { try { TokenManager.DecodeToken(token); return(true); } catch (Exception) { return(false); } }
public IActionResult OnGet(string token) { string filename = null; if (token == null) { return(NotFound()); } //convert the token back to values var result = TokenManager.DecodeToken(token); if (result.FormatOk) { if (result.Schema == "IXX") { filename = _repo.GetFileNameForItem(result.ItemNo); } else { // Does not really belong in REPO but form now to keep things simple bool isVerified = _repo.VerifyTokenValues(result.ItemNo, result.OrderNo, result.PostalCode); if (isVerified) { filename = _repo.GetFileNameForItem(result.ItemNo); } } if (filename != null) { return(_repo.GetFile(filename)); } } return(NotFound()); }