Skip to content

DataProtection - Wrong activation time #33071

@georgelivingston

Description

@georgelivingston

Describe the bug

Activation time is ahead of the creation time and causing (Cookies was not authenticated. Failure message: Unprotect ticket failed)

To Reproduce

Multiple service is deployed with the below code to protect the cookies. Everything works as expected. From yesterday, suddenly facing this error (Cookies was not authenticated. Failure message: Unprotect ticket failed) in one service, were the other services works as expected. On further analysis, found activate date is ahead of the creation date in the blob stored XML.

var dataProtectionBuilder = services.AddDataProtection()
                .PersistKeysToAzureBlobStorage(environmentVariable.AzureBlobStorage, "secret", "secretkey.xml")
                .SetApplicationName("cookiename");
dataProtectionBuilder?.ProtectKeysWithCertificate(x509ClientCertificate);

Below is the active key in the blob stored xml file.

<creationDate>2021-05-26T09:35:20.9324376Z</creationDate>
<activationDate>2021-05-26T09:35:20.078957Z</activationDate
<expirationDate>2021-08-24T09:35:20.078957Z</expirationDate>

Exceptions (if any)

Microsoft.AspNetCore.Authentication.Cookies.CookieAuthenticationHandler[7]
Cookies was not authenticated. Failure message: Unprotect ticket failed

Further technical details

  • ASP.NET Core version - 3.1
  • Microsoft.AspNetCore.DataProtection, Version=3.1.0.0

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions