Sitecore Ticket Manager

Sitecore TicketManager


What is TicketManager?

It’s just a piece of code in sitecore helps to manage the authentication of the users.
Whevener a new user sign in to sitecore instance, an authentication ticket will be issued.

Where is its data?

The ticket information for the authenticated user is stored in the [Properties] table of the core database.
[this information is valid till sitecore 9.0.1]

When to use it?

It helps to pragmatically login the users as the following

using Sitecore.Web.Authentication;

AuthenticationManager.Login(userName);
string ticket = TicketManager.CreateTicket(userName, @"/sitecore/shell");
HttpContext current = HttpContext.Current;
if (current != null)
{
    HttpCookie cookie = new HttpCookie(TicketManager.CookieName, ticket)
    {
        HttpOnly = true
    };
    current.Response.AppendCookie(cookie);    
}

Sitecore stores the ticket id of the user in a cookie named
"sitecore_userticket"

More information to know

There’s a registered scheduled task in the configuration

<!-- Agent to remove expired Client authentication tickets  -->
<agent type="Sitecore.Tasks.CleanupAuthenticationTicketsAgent" method="Run" interval="04:00:00" />

Don’t remove or disable it unless you have a strong justification to do that. Otherwise, your database will be flooded with expired tickets and the instance will be getting slower.

Comments