<div dir="ltr">Did you actually add @SecurityDomain("keycloak")?<div><br></div><div>Does the request require authentication (does it have a security-constraint in web.xml)? </div></div><div class="gmail_extra"><br><div class="gmail_quote">On 5 February 2016 at 10:41, PAA KOJO KONDUAH AMOS <span dir="ltr"><<a href="mailto:pkkamos@gmail.com" target="_blank">pkkamos@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div lang="EN-US" link="blue" vlink="#954F72"><div><p class="MsoNormal">Hello, I am trying to retrieve information about the User logged into the webapp via keycloak. I have seen around information on using the following;</p><p class="MsoNormal"><u></u> <u></u></p><pre><b><i><span style="color:#44546a">@SecurityDomain("keycloak")</span></i></b><span style="color:#44546a"><u></u><u></u></span></pre><p class="MsoNormal"><u></u> <u></u></p><div><pre style="background:#eeeeee"><span><b><i><span style="font-family:Consolas;color:#44546a;border:none windowtext 1.0pt;padding:0in;background:#eeeeee">@Context</span></i></b></span><span><b><i><span style="font-family:Consolas;color:#44546a;border:none windowtext 1.0pt;padding:0in;background:#eeeeee"><u></u><u></u></span></i></b></span></pre><pre style="background:#eeeeee"><span><b><i><span style="font-family:Consolas;color:#44546a;border:none windowtext 1.0pt;padding:0in;background:#eeeeee">SecurityContext</span></i></b></span><span><b><i><span style="font-family:Consolas;color:#44546a;border:none windowtext 1.0pt;padding:0in;background:#eeeeee"> sc</span></i></b></span><span><b><i><span style="font-family:Consolas;color:#44546a;border:none windowtext 1.0pt;padding:0in;background:#eeeeee">;</span></i></b></span><b><i><span style="font-family:Consolas;color:#44546a;border:none windowtext 1.0pt;padding:0in;background:#eeeeee"><u></u><u></u></span></i></b></pre></div><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">And </p><pre><b><i><span style="color:#44546a">KeycloakPrincipal principal = (KeycloakPrincipal) sc.getUserPrincipal();<u></u><u></u></span></i></b></pre><pre><b><i><span style="color:#44546a"><u></u> <u></u></span></i></b></pre><pre><b><i><span style="color:#44546a"><u></u> <u></u></span></i></b></pre><pre><b><i><span style="color:#44546a"><u></u> <u></u></span></i></b></pre><p class="MsoNormal"><b>But the above line is returning a NullPointerException</b><b><span style="font-size:12.0pt">.<u></u><u></u></span></b></p><pre><b><i><span style="color:black"><u></u> <u></u></span></i></b></pre><p><span style="font-family:"Calibri",sans-serif;color:black">I must say, I have already done the required configuration; as in </span>enabling the Keycloak Subsystem within my app server's server configuration:<span> </span><code><span style="font-size:11.0pt">standalone.xml</span></code>.<span style="font-size:10.0pt"><u></u><u></u></span></p><p class="MsoNormal">Please any lead on how to retrieve the logged in User via KeyCloak?</p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">Sent from <a href="https://go.microsoft.com/fwlink/?LinkId=550986" target="_blank">Mail</a> for Windows 10</p><p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Times New Roman",serif"><u></u> <u></u></span></p></div></div><br>_______________________________________________<br>
keycloak-user mailing list<br>
<a href="mailto:keycloak-user@lists.jboss.org">keycloak-user@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/keycloak-user" rel="noreferrer" target="_blank">https://lists.jboss.org/mailman/listinfo/keycloak-user</a><br></blockquote></div><br></div>