Doing so requires creating custom claims-based authentication via the SecurityEvents.Authenticate handler: https://docs.kentico.com/k12/custom-development/handling-global-events/reference-global-system-events#Reference-Globalsystemevents-SecurityEvents. In the handler, you can get the claims token from the request (I believe it's available at HttpContext.Current.Request.Form["wresult"]) and parse the token for any information needed.
You will need to decode the token, then create a new XmlDocument to easily read from it. With this information, you can set values on the e.User object, add the user to roles, etc.