U4-10180 - Update how token is generated and verified for the AdminTokenAuthorizeAttribute

Created by Shannon Deminick 19 Jul 2017, 00:34:50 Updated by Shannon Deminick 21 Aug 2017, 08:11:01

Subtask of: U4-9609

Currently this is done using Encryption but it should instead do:

  • Use hashing of the values instead of encryption
  • Include a timestamp in the hash so that the token has an expiry

This will make the token more secure and also avoid issues when the encrypted value cannot be decrypted resulting in errors like this which occur when an invalid token is sent to a site and it cannot be decrypted

Umbraco.Web.Mvc.AdminTokenAuthorizeAttribute - Failed to format passed in token value
System.Security.Cryptography.CryptographicException: Error occurred during a cryptographic operation.
   at System.Web.Security.Cryptography.HomogenizingCryptoServiceWrapper.HomogenizeErrors(Func`2 func, Byte[] input)
   at System.Web.Security.Cryptography.HomogenizingCryptoServiceWrapper.Unprotect(Byte[] protectedData)
   at System.Web.Security.FormsAuthentication.Decrypt(String encryptedTicket)
   at Umbraco.Core.StringExtensions.DecryptWithMachineKey(String value)
   at Umbraco.Web.Mvc.AdminTokenAuthorizeAttribute.AuthorizeCore(HttpContextBase httpContext)


Priority: Normal

Type: Task

State: Open

Assignee: Shannon Deminick

Difficulty: Normal


Backwards Compatible: True

Fix Submitted:

Affected versions:

Due in version:


Story Points: 1