[keycloak-user] Problems to get an AuthorizationContext using keycloak and Jetty

Celso Agra celso.agra at gmail.com
Sat Dec 17 20:20:50 EST 2016


Hi all,

Need a help to understand this problem. I'm trying to use Jetty in a simple
application. Just to use simple JSP pages.
So, I followed this configuration about Jetty 9.X and adapter:
https://stianst.gitbooks.io/keycloak-documentation/content/securing_apps_guide/topics/oidc/java/jetty9-adapter.html

As an example, I'm using the same code and configs of servlet-authz (
https://github.com/keycloak/keycloak/tree/master/examples/authz/servlet-authz
).

Unfortunately when I try to run this code (in index.jsp):
<%
    KeycloakSecurityContext keycloakSecurityContext =
(KeycloakSecurityContext)
request.getAttribute(KeycloakSecurityContext.class.getName());
    AuthorizationContext authzContext =
keycloakSecurityContext.getAuthorizationContext();
%>

I got an object authzContext as null. So, I can't get the authorization
context, and when I try to get the permissions -
authzContext.getPermissions(); I got a java.lang.NullPointerException.
Has anyone had this same problem with Jetty?

Thanks.

Best regards,

-- 
---
*Celso Agra*


More information about the keycloak-user mailing list