<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">Good morning,<br><br>I am trying to set up an application that uses:<br><br>1. Spring 3.2.x<br><br>I used to have spring security for the authentication of the users, and I could have a logout listener, triggering the SessionDestroyedEvent like this (whenever a session was destroyed) :<div><br></div><div><pre style="font-family: 'Bitstream Vera Sans Mono', 'DejaVu Sans Mono', Monaco, Courier, monospace; line-height: 1.4000000000000001; margin-top: 0px; margin-bottom: 0px; padding: 0px; color: rgb(51, 51, 51);"><span class="nd">@Service</span>
<a name="cl-27" style="color: rgb(59, 115, 175);"></a><span class="kd" style="font-weight: bold;">public</span> <span class="kd" style="font-weight: bold;">class</span> <span class="nc" style="color: rgb(68, 85, 136); font-weight: bold;">LogoutListener</span> <span class="kd" style="font-weight: bold;">implements</span> <span class="n">ApplicationListener</span><span class="o" style="font-weight: bold;">&lt;</span><span class="n">SessionDestroyedEvent</span><span class="o" style="font-weight: bold;">&gt;</span> <span class="o" style="font-weight: bold;">{</span>
<a name="cl-28" style="color: rgb(59, 115, 175);"></a>
<a name="cl-29" style="color: rgb(59, 115, 175);"></a>    <span class="nd">@Autowired</span>
<a name="cl-30" style="color: rgb(59, 115, 175);"></a>    <span class="kd" style="font-weight: bold;">private</span> <span class="n">SessionRegistryImpl</span> <span class="n">sessionRegistry</span><span class="o" style="font-weight: bold;">;</span>

<a name="cl-40" style="color: rgb(59, 115, 175);"></a>    <span class="nd">@Override</span>
<a name="cl-41" style="color: rgb(59, 115, 175);"></a>    <span class="kd" style="font-weight: bold;">public</span> <span class="kt" style="color: rgb(68, 85, 136); font-weight: bold;">void</span> <span class="nf" style="color: rgb(153, 0, 0); font-weight: bold;">onApplicationEvent</span><span class="o" style="font-weight: bold;">(</span><span class="n">SessionDestroyedEvent</span> <span class="n">event</span><span class="o" style="font-weight: bold;">)</span> <span class="o" style="font-weight: bold;">{</span>
<a name="cl-42" style="color: rgb(59, 115, 175);"></a>        <span class="n">List</span><span class="o" style="font-weight: bold;">&lt;</span><span class="n">SecurityContext</span><span class="o" style="font-weight: bold;">&gt;</span> <span class="n">lstSecurityContext</span> <span class="o" style="font-weight: bold;">=</span> <span class="n">event</span><span class="o" style="font-weight: bold;">.</span><span class="na" style="color: rgb(0, 128, 128);">getSecurityContexts</span><span class="o" style="font-weight: bold;">();</span>
<a name="cl-44" style="color: rgb(59, 115, 175);"></a>        <span class="n">AuthenticateUser</span> <span class="n">authenticateUser</span><span class="o" style="font-weight: bold;">;</span>
<a name="cl-45" style="color: rgb(59, 115, 175);"></a>        <span class="k" style="font-weight: bold;">for</span> <span class="o" style="font-weight: bold;">(</span><span class="n">SecurityContext</span> <span class="n">securityContext</span> <span class="o" style="font-weight: bold;">:</span> <span class="n">lstSecurityContext</span><span class="o" style="font-weight: bold;">)</span> <span class="o" style="font-weight: bold;">{</span>
<a name="cl-46" style="color: rgb(59, 115, 175);"></a>            <span class="n">authenticateUser</span> <span class="o" style="font-weight: bold;">=</span> <span class="o" style="font-weight: bold;">(</span><span class="n">AuthenticateUser</span><span class="o" style="font-weight: bold;">)</span> <span class="n">securityContext</span><span class="o" style="font-weight: bold;">.</span><span class="na" style="color: rgb(0, 128, 128);">getAuthentication</span><span class="o" style="font-weight: bold;">().</span><span class="na" style="color: rgb(0, 128, 128);">getPrincipal</span><span class="o" style="font-weight: bold;">();</span>
<a name="cl-47" style="color: rgb(59, 115, 175);"></a>            <span class="n">logger</span><span class="o" style="font-weight: bold;">.</span><span class="na" style="color: rgb(0, 128, 128);">trace</span><span class="o" style="font-weight: bold;">(</span><span class="s" style="color: rgb(187, 136, 68);">"Current session destroyed from user [{}]"</span><span class="o" style="font-weight: bold;">,</span> <span class="n">authenticateUser</span><span class="o" style="font-weight: bold;">.</span><span class="na" style="color: rgb(0, 128, 128);">getEmail</span><span class="o" style="font-weight: bold;">());</span>
<a name="cl-48" style="color: rgb(59, 115, 175);"></a><br></pre><pre style="font-family: 'Bitstream Vera Sans Mono', 'DejaVu Sans Mono', Monaco, Courier, monospace; line-height: 1.4000000000000001; margin-top: 0px; margin-bottom: 0px; padding: 0px; color: rgb(51, 51, 51);"><br></pre><pre style="font-family: 'Bitstream Vera Sans Mono', 'DejaVu Sans Mono', Monaco, Courier, monospace; line-height: 1.4000000000000001; margin-top: 0px; margin-bottom: 0px; padding: 0px; color: rgb(51, 51, 51);">            //Handle the session destruction event..</pre><pre style="font-family: 'Bitstream Vera Sans Mono', 'DejaVu Sans Mono', Monaco, Courier, monospace; line-height: 1.4000000000000001; margin-top: 0px; margin-bottom: 0px; padding: 0px; color: rgb(51, 51, 51);"><br></pre><pre style="font-family: 'Bitstream Vera Sans Mono', 'DejaVu Sans Mono', Monaco, Courier, monospace; line-height: 1.4000000000000001; margin-top: 0px; margin-bottom: 0px; padding: 0px; color: rgb(51, 51, 51);">
<a name="cl-49" style="color: rgb(59, 115, 175);"></a>        <span class="o" style="font-weight: bold;">}</span>
<a name="cl-50" style="color: rgb(59, 115, 175);"></a>    <span class="o" style="font-weight: bold;">}</span></pre>}</div><div><br></div><div><br></div><div>Is there any way I could have that functionality with Keycloak?<br><br>Thanks in advance,<br>Jason</div></body></html>