[keycloak-user] KeycloakSecurityContext returns NULL using Tomcat Adapter

LEONARDO NUNES leo.nunes at gjccorp.com.br
Wed Feb 17 08:11:55 EST 2016


Hi everyone,

I have an application deployed on Tomcat 7 using the Tomcat Adapter.
When i'm logged in and I go to a non-secured URL, KeycloakSecurityContext returns null.
I deployed the same application to the Keycloak Standalone Server, there I don't have this problem.

The code below returns null when called from /movies/, and works when called from /article/
(KeycloakSecurityContext) request.getAttribute(KeycloakSecurityContext.class.getName());

In my web.xml I have only one security-constraint securing /article/*

WEB.XML:
<security-constraint>
    <web-resource-collection>
        <web-resource-name>Articles</web-resource-name>
        <url-pattern>/article/*</url-pattern>
    </web-resource-collection>
    <auth-constraint>
        <role-name>user</role-name>
    </auth-constraint>
</security-constraint>


________________________________
Esta mensagem pode conter informa??o confidencial e/ou privilegiada. Se voc? n?o for o destinat?rio ou a pessoa autorizada a receber esta mensagem, n?o poder? usar, copiar ou divulgar as informa??es nela contidas ou tomar qualquer a??o baseada nessas informa??es. Se voc? recebeu esta mensagem por engano, por favor avise imediatamente o remetente, respondendo o e-mail e em seguida apague-o. Agradecemos sua coopera??o.

This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/keycloak-user/attachments/20160217/0c9713f2/attachment.html 


More information about the keycloak-user mailing list