Session ID Customization
tCell supports Account Takeover, which is a major and common use case. Depending on the policy, tCell uses session IDs as one of the parameters to detect Account Takeover.
In most cases, the tCell agent will automatically detect the session ID used by the application with no customization. However, sometimes the application customizes its session ID handling, therefore, the standard cookie session is not appropriate. For such cases when using .NET Core agent, customers can write a custom lambda and pass it to the UseTcellSessionId middleware function defined as follows:
UseTcellSessionId usage
1public IApplicationBuilder UseTcellSessionId(this IApplicationBuilder app, Func<HttpContext, string> action);
The return type (string) from the lambda will be the custom session ID. Also note the middleware is a .NET Core middleware component, and should be configured using the standard .NET Core Service Startup Configure method.
Example
While you can use any form of context manipulation, the following use case occurs when tCell removes a dynamic salt at the end of the session ID. In this example, a partial snippet of a Startup class with a custom lambda retrieves the session ID from cookie "abc" and strips off the beginning of the string before the hyphen "-".
Example Session Handling Snippet
1using Microsoft.Extensions.Configuration;2using Tcell.Agent.AspNetCore;3...45public class Startup{67...89public void Configure(IApplicationBuilder app, IHostingEnvironment env)10{1112if(env.IsDevelopment())13{14app.UseDeveloperExceptionPage();15}1617app.UseStaticFiles();1819// add logic to extract the Session ID20app.UseTcellSessionId(context => GetTheCustomSessionId(context));2122app.UseMvc(routes =>23{24routes.MapRoute(25name: "default",26template: "{controller=Home}/{action=Index}/{id?}");27});28}293031private const string CustomSessionKey = "abc";32private string GetTheCustomSessionId(HttpContext ctxt)33{34_logger.LogInformation("getting session from context");35var cookieValue = ctxt.Request.Cookies[CustomSessionKey];3637var prefix = cookieValue.Split("-").First();38return prefix;39}404142}43