Is there a pipeline that I can hook into, when the CookieAuthentication time, that has been defined in config, expires?

          <processor name="CookieAuthentication" type="Sitecore.Owin.Authentication.Pipelines.Initialize.CookieAuthentication, Sitecore.Owin.Authentication"
                   resolve="true" patch:instead="processor[@name='CookieAuthentication']">
            <!-- Controls how much time the cookie will remain valid from the point it is created.
             Format: d:hh:mm:ss

             No matter the cookie is persistent or not, OWIN authentication will not pass the expired cookie.
             ExpireTimeSpan could be overwritten by the http://www.sitecore.net/identity/claims/cookieExp claim where
             the claim value is Unix time expressed as the number of seconds that have elapsed since 1970-01-01T00:00:00Z. -->

As my user doesn't get logged out automatically from Keycloak, I need to call the logout endpoint myself when the session expires. The Owin Middleware is not been called, so I can't do it from there.

  • 1
    I don't think there is. This is not an action happening server side, unless the user happens to visit again with his or her expired cookie.
    – Mark Cassidy
    Commented Jun 18, 2021 at 11:19
  • when the session expires, keycloak would ask user to re-auth , wont it ?
    – Abhay Dhar
    Commented Jun 18, 2021 at 18:55
  • Unfortunatelly Keycloak doesn't. The session of the user never expires and it seems there ist still a cookie or something aktiv, which redirects the user back to sitecore without asking for username and password again. But the access and refresh cookie is no longer valid Commented Jun 21, 2021 at 8:39


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.