Stian,
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.
At Tomcat the code below returns null when called from /movies/, and works when called from /article/
At Keycloak Standalone Server /movies/ and /article/ works fine.
(KeycloakSecurityContext) request.getAttribute(KeycloakSecurityContext.class.getName());
Why is this happening?
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>