<div dir="ltr"><div>yes i have done that in : standalone.xml :</div><div><br></div><div><p align="LEFT"><font color="#008080"><font color="#008080"><</font></font><font color="#3f7f7f"><font color="#3f7f7f">extensions</font></font><font color="#008080"><font color="#008080">></font></font></p><font color="#008080"><font color="#008080">
</font></font><font></font><p align="LEFT"><font>        </font><font color="#008080"><font color="#008080"><</font></font><font color="#3f7f7f"><font color="#3f7f7f">extension</font></font><font> </font><font color="#7f007f"><font color="#7f007f">module</font></font><font>=</font><i><font color="#2a00ff"><font color="#2a00ff">"org.keycloak.keycloak-wildfly-subsystem"</font></font></i><font> </font><font color="#008080"><font color="#008080">/></font></font></p><font color="#008080"><font color="#008080">
</font></font><p align="LEFT"><font color="#008080"><font color="#008080"></</font></font><font color="#3f7f7f"><font color="#3f7f7f">extensions</font></font><font color="#008080"><font color="#008080">></font></font></p><font color="#008080"><font color="#008080">
</font></font><font><p align="LEFT"></p>
</font><font color="#008080"><font color="#008080"></font></font><p align="LEFT"><font color="#008080"><font color="#008080"><</font></font><font color="#3f7f7f"><font color="#3f7f7f">subsystem</font></font><font> </font><font color="#7f007f"><font color="#7f007f">xmlns</font></font><font>=</font><i><font color="#2a00ff"><font color="#2a00ff">"urn:jboss:domain:security:1.2"</font></font></i><font color="#008080"><font color="#008080">></font></font></p><font color="#008080"><font color="#008080">
</font></font><font></font><p align="LEFT"><font>        </font><font color="#008080"><font color="#008080"><</font></font><font color="#3f7f7f"><font color="#3f7f7f">security-domains</font></font><font color="#008080"><font color="#008080">></font></font></p><font color="#008080"><font color="#008080">
</font></font><font></font><p align="LEFT"><font>                </font><font color="#008080"><font color="#008080"><</font></font><font color="#3f7f7f"><font color="#3f7f7f">security-domain</font></font><font> </font><font color="#7f007f"><font color="#7f007f">name</font></font><font>=</font><i><font color="#2a00ff"><font color="#2a00ff">"keycloak"</font></font></i><font color="#008080"><font color="#008080">></font></font></p><font color="#008080"><font color="#008080">
</font></font><font></font><p align="LEFT"><font>                        </font><font color="#008080"><font color="#008080"><</font></font><font color="#3f7f7f"><font color="#3f7f7f">authentication</font></font><font color="#008080"><font color="#008080">></font></font></p><font color="#008080"><font color="#008080">
</font></font><font></font><p align="LEFT"><font>                                </font><font color="#008080"><font color="#008080"><</font></font><font color="#3f7f7f"><font color="#3f7f7f">login-module</font></font><font> </font><font color="#7f007f"><font color="#7f007f">code</font></font><font>=</font><i><font color="#2a00ff"><font color="#2a00ff">"org.keycloak.adapters.jboss.KeycloakLoginModule"</font></font></i><font> </font><font color="#7f007f"><font color="#7f007f">flag</font></font><font>=</font><i><font color="#2a00ff"><font color="#2a00ff">"required"</font></font></i><font> </font><font color="#008080"><font color="#008080">/></font></font></p><font color="#008080"><font color="#008080">
</font></font><font></font><p align="LEFT"><font>                        </font><font color="#008080"><font color="#008080"></</font></font><font color="#3f7f7f"><font color="#3f7f7f">authentication</font></font><font color="#008080"><font color="#008080">></font></font></p><font color="#008080"><font color="#008080">
</font></font><font></font><p align="LEFT"><font>                </font><font color="#008080"><font color="#008080"></</font></font><font color="#3f7f7f"><font color="#3f7f7f">security-domain</font></font><font color="#008080"><font color="#008080">></font></font></p><font color="#008080"><font color="#008080">
</font></font><font></font><p align="LEFT"><font>        </font><font color="#008080"><font color="#008080"></</font></font><font color="#3f7f7f"><font color="#3f7f7f">security-domains</font></font><font color="#008080"><font color="#008080">></font></font></p><font color="#008080"><font color="#008080">
</font></font><p align="LEFT"><font color="#008080"><font color="#008080"></</font></font><font color="#3f7f7f"><font color="#3f7f7f">subsystem</font></font><font color="#008080"><font color="#008080">></font></font></p><font color="#008080"><font color="#008080">
</font></font><font><p align="LEFT"></p>
</font><font color="#008080"><font color="#008080"></font></font><p align="LEFT"><font color="#008080"><font color="#008080"><</font></font><font color="#3f7f7f"><font color="#3f7f7f">profile</font></font><font color="#008080"><font color="#008080">></font></font></p><font color="#008080"><font color="#008080">
</font></font><font></font><p align="LEFT"><font>        </font><font color="#008080"><font color="#008080"><</font></font><font color="#3f7f7f"><font color="#3f7f7f">subsystem</font></font><font> </font><font color="#7f007f"><font color="#7f007f">xmlns</font></font><font>=</font><i><font color="#2a00ff"><font color="#2a00ff">"urn:jboss:domain:keycloak:1.0"</font></font></i><font> </font><font color="#008080"><font color="#008080">/></font></font></p><font color="#008080"><font color="#008080">
</font></font><p><font color="#008080"><font color="#008080"></</font></font><font color="#3f7f7f"><font color="#3f7f7f">profile</font></font><font color="#008080"><font color="#008080">></font></font></p></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Oct 9, 2014 at 12:59 PM, Stian Thorgersen <span dir="ltr"><<a href="mailto:stian@redhat.com" target="_blank">stian@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Did you follow the steps in the documentation? Including creating a security-domain?<br>
<span><br>
----- Original Message -----<br>
> From: "Alexander Chriztopher" <<a href="mailto:alexander.chriztopher@gmail.com">alexander.chriztopher@gmail.com</a>><br>
</span><span>> To: "Stian Thorgersen" <<a href="mailto:stian@redhat.com">stian@redhat.com</a>><br>
> Cc: <a href="mailto:keycloak-user@lists.jboss.org">keycloak-user@lists.jboss.org</a><br>
> Sent: Thursday, 9 October, 2014 12:28:47 PM<br>
> Subject: Re: [keycloak-user] How to get current user in my application<br>
><br>
> Added : @SecurityDomain("keycloak") without any success ! Still getting a<br>
> NullPointerException.<br>
><br>
> The security is now working effectively by adding the @SecurityDomain<br>
> annotation as i had to add the annotation : @PermitAll on my methods to be<br>
> able to access my methods.<br>
><br>
> Are my imports the right ones ? :<br>
><br>
</span>> *import* javax.ws.rs.core.Context;<br>
><br>
> *import* javax.ws.rs.core.SecurityContext;<br>
<div class="HOEnZb"><div class="h5">><br>
> On Thu, Oct 9, 2014 at 10:54 AM, Stian Thorgersen <<a href="mailto:stian@redhat.com">stian@redhat.com</a>> wrote:<br>
><br>
> > See<br>
> > <a href="http://docs.jboss.org/keycloak/docs/1.0.2.Final/userguide/html/ch07.html#jboss-adapter" target="_blank">http://docs.jboss.org/keycloak/docs/1.0.2.Final/userguide/html/ch07.html#jboss-adapter</a>,<br>
> > try adding @SecurityDomain("keycloak").<br>
> ><br>
> > ----- Original Message -----<br>
> > > From: "Alexander Chriztopher" <<a href="mailto:alexander.chriztopher@gmail.com">alexander.chriztopher@gmail.com</a>><br>
> > > To: <a href="mailto:keycloak-user@lists.jboss.org">keycloak-user@lists.jboss.org</a><br>
> > > Sent: Wednesday, 8 October, 2014 12:28:09 PM<br>
> > > Subject: [keycloak-user] How to get current user in my application<br>
> > ><br>
> > > Hi,<br>
> > ><br>
> > > Am using Keycloak with my JEE 7 application deployed on Wildfly.<br>
> > ><br>
> > > I would like to get a handle on the currently authenticated user by doing<br>
> > > this :<br>
> > ><br>
> > ><br>
> > ><br>
> > > import javax.ejb.LocalBean;<br>
> > ><br>
> > > import javax.faces.bean.SessionScoped;<br>
> > ><br>
> > > import javax.inject.Named;<br>
> > ><br>
> > ><br>
> > ><br>
> > > import javax.ws.rs.core.Context;<br>
> > ><br>
> > > import javax.ws.rs.core.SecurityContext;<br>
> > ><br>
> > ><br>
> > ><br>
> > > import org.keycloak.KeycloakPrincipal;<br>
> > ><br>
> > ><br>
> > ><br>
> > > @LocalBean<br>
> > ><br>
> > > @Named<br>
> > ><br>
> > > @SessionScoped<br>
> > ><br>
> > > public class SessionController {<br>
> > ><br>
> > ><br>
> > ><br>
> > > @Context<br>
> > ><br>
> > > private SecurityContext securityContext ;<br>
> > ><br>
> > ><br>
> > ><br>
> > > public void method() {<br>
> > ><br>
> > > KeycloakPrincipal principal = (KeycloakPrincipal) securityContext .<br>
> > > getUserPrincipal ();<br>
> > ><br>
> > > }<br>
> > ><br>
> > ><br>
> > ><br>
> > > }<br>
> > ><br>
> > > Unfortunately i get a NullPointerException on the call to<br>
> > securityContext.<br>
> > ><br>
> > > Am i doing things right ? Shouldn't i get a security context this way ?<br>
> > ><br>
> > > Thanks for any help.<br>
> > ><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" target="_blank">https://lists.jboss.org/mailman/listinfo/keycloak-user</a><br>
> ><br>
><br>
</div></div></blockquote></div><br></div>