Why does backoffice log out after ~1 minute?
t

TackleMcClean 🏅

over 1 year ago
We have suffered from this issue before when setting up a new project on Azure. Old thread: https://discord.com/channels/869656431308189746/1183873525031911554 Now, we are seeing this issue on local development on localhost:8080 on a project where we're upgrading from Umbraco 10 to 13. After logging into the CMS, there is about a 40-60 second wait. Then there is a call to
/umbraco/backoffice/umbracoapi/authentication/GetRemainingTimeoutSeconds
that returns:
)]}',
0.0
Upon which the user is logged out showing message "Session timed out." We have tried using incognito mode to rule out cookies, as well as completely fresh browser profile in Chrome. Are we missing something completely basic for this problem to occur? appsetting Umbraco.CMS.Global.TimeOut is set to
08:00:00
. 8 hours is more than 1 minute. We have not supplied any other setting that should affect this. In our previous 'fresh' project the settings were also default. Umbraco.CMS.Security.KeepUserLoggedIn is not set to
true
thus it should be interpreted as the default
false
. > When set to false a user will be logged out after a specific amount of time has passed with no activity. You can specify this time span in the global settings with the TimeOut key. This is exactly what we've done. Umbraco.CMS.Security.AllowConcurrentLogins is showing a bit of a strange behavior. We don't have this defined at all. But setting it to true, and then restarting Umbraco, and then simply reloading the browser window of the recently auto-logged out user in a fresh browser profile will automatically log them in and show the backoffice. Logging out above mentioned user and then logging in seems to work fine as well.
GetRemainingTimeoutSeconds
returns the full 8 hours. However, logging out, setting
AllowConcurrentLogins
to false again and then logging back in, the problem reappears. In our tests, this is the only browser window using the site. Why are we seeing this problem?
Issues with handling Save and Publish events in Umbraco - Need Help!
b

baristaner

over 1 year ago
Hello everyone, I am encountering some challenges with handling Save and Publish events in Umbraco, specifically using SaveAndPublishHandler class. Here are the details of my issue: **Problem Description**: I have implemented a SaveAndPublishHandler class in Umbraco to handle Saved and Published events for content items. The goal is to send an HTTP POST request to an external endpoint whenever content is saved or published with a specific ParentId (in my case, ParentId 1249). *Code : *
c#
        public SaveAndPublishHandler(IContentService contentService)
        {
            _contentService = contentService;
        }

        public void Initialize()
        {
            ContentService.Saved += ContentService_Saved;
        }

        public void Terminate()
        {
            ContentService.Saved -= ContentService_Saved;
        }

        private void ContentService_Saved(IContentService sender, SaveEventArgs<IContent> e)
        {
            foreach (var content in e.SavedEntities)
            {
                if (content.ParentId == 1249)
                {
                    var dataToSend = new { ContentId = content.Id, Title = content.Name };
                    var json = Newtonsoft.Json.JsonConvert.SerializeObject(dataToSend);
                    var contentToSend = new StringContent(json, Encoding.UTF8, "application/json");

                    using (var httpClient = new HttpClient())
                    {
                        var endpointUrl = "http://localhost:65137/umbraco/surface/UpdateApprovedAccount/UpdateApprovedAccountV2"; 

                        var response = httpClient.PostAsync(endpointUrl, contentToSend).Result;

                        var responseContent = response.Content.ReadAsStringAsync().Result;
                    }
                }
            }
        }
Composing :
c#
public void Compose(Composition composition) {
composition.Components().Append<SaveAndPublishHandler>();
}
Umbraco hosted in Azure is showing a lot of Cryptographic warnings in the log
c

CarlCod_es

over 1 year ago
We've got Umbraco hosted in Azure, in a load-balanced environment with deployment slots. We're seeing a lot of warnings in the logs. Umbraco Version 13.0.1 W : Error unprotecting the session cookie. Stack Trace : System.Security.Cryptography.CryptographicException: The key {078a31d2-3d8c-4b43-baeb-a639524b05c5} was not found in the key ring. For more information go to https://aka.ms/aspnet/dataprotectionwarning at Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingBasedDataProtector.UnprotectCore(Byte[] protectedData, Boolean allowOperationsOnRevokedKeys, UnprotectStatus& status) at Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingBasedDataProtector.Unprotect(Byte[] protectedData) at Microsoft.AspNetCore.Session.CookieProtection.Unprotect(IDataProtector protector, String protectedText, ILogger logger) We also see a rare instance of an error, but this seems much less frequent Microsoft.AspNetCore.Antiforgery.AntiforgeryValidationException: The antiforgery token could not be decrypted. Stacktrace : System.Security.Cryptography.CryptographicException: The key {84cea658-5bcd-439a-b175-d1c4bb7956f7} was not found in the key ring. For more information go to https://aka.ms/aspnet/dataprotectionwarning at Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingBasedDataProtector.UnprotectCore(Byte[] protectedData, Boolean allowOperationsOnRevokedKeys, UnprotectStatus& status) at Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingBasedDataProtector.Unprotect(Byte[] protectedData) at Microsoft.AspNetCore.Antiforgery.DefaultAntiforgeryTokenSerializer.Deserialize(String serializedToken) --- End of inner exception stack trace --- at Microsoft.AspNetCore.Antiforgery.DefaultAntiforgeryTokenSerializer.Deserialize(String serializedToken) at Microsoft.AspNetCore.Antiforgery.DefaultAntiforgery.GetCookieTokenDoesNotThrow(HttpContext httpContext) Anyone seen this issue, or similar?