I've recently created an application that has a Wicket frontend (and Spring
backend) authenticated by Keycloak. It's a relatively simple integration
really, all pages require a valid Keycloak session, so it uses the default
Keycloak servlet filter adapter:

https://search.maven.org/artifact/org.keycloak/keycloak-servlet-filter-adapter/5.0.0/jar

In my setup I've mapped the Keycloak filter to all URLs (before the Wicket
filter). Using this filter is simply a matter of adding it to your web.xml
and making sure you have a keycloak.json file in your WEB-INF folder.

In Wicket, you can then get the Keycloak context from the RequestCycle:

ServletWebRequest request = (ServletWebRequest)
RequestCycle.get().getRequest();
HttpServletRequest containerRequest = request.getContainerRequest();
KeycloakSecurityContext securityContext = (KeycloakSecurityContext)
containerRequest.getAttribute(KeycloakSecurityContext.class.getName());

Hope this helps.

Sincerely,

Jeroen


Op wo 10 apr. 2019 om 16:43 schreef Calin Pavel <calin.pa...@gmail.com>:

> Hi everybody,
>
> Did anybody integrated Wicket with Keycloak?
> Do you have any sample how this could be done - to restrict access to
> pages, to authenticate user ....
>
>
> Thank you,
> Calin Pavel
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

-- 
Jeroen Steenbeeke

Reply via email to