MarcGiffing / wicket-spring-boot

Spring Boot starter for Apache Wicket
151 stars 61 forks source link

WicketBootSecuredWebApplication with spring security gives an exception #172

Closed abiuan closed 1 year ago

abiuan commented 3 years ago

Hello, I'm trying to add authentication to a working wicket spring boot application. I followed the instructions on the github page, enabling spring-boot-starter-security, creating a bean extending WicketBootSecuredWebApplication, etc..

When I look for a page of the web application I have the following exception: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.giffing.wicket.spring.boot.context.security.AuthenticatedWebSessionConfig' available.

What I'm doing wrong?

Regards

Wicket version: 9.0.0 Spring boot version: 2.3.4 wicket-spring-boot version: 3.0.4

MarcGiffing commented 3 years ago

I think the documentation is outdated. Please look at the example projcect. You don't have to extend from the WicketBootSecuredWebApplication at all. It will automatically picked up and configured: https://github.com/MarcGiffing/wicket-spring-boot/blob/38d9068448a5a742d4e4da30e9efeeb0b2303a58/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/configuration/extensions/external/spring/security/SpringSecurityConfig.java

I'll update the doucmentation or make it possible to extend WicketBootSecuredWebApplication without any problems

abiuan commented 3 years ago

Thanks, works fine. Now I have another issue. I'm using google as authentication provider and I have to implement a logout button. I'm trying to use AuthenticatedWebSession.get().invalidate() but I get an exception: java.lang.ClassCastException: class org.apache.wicket.protocol.http.WebSession cannot be cast to class org.apache.wicket.authroles.authentication.AuthenticatedWebSession (org.apache.wicket.protocol.http.WebSession and org.apache.wicket.authroles.authentication.AuthenticatedWebSession are in unnamed module of loader 'app'). Is there another way to do it?

Regards

LordEliseus commented 3 years ago

Hello, Thanks MarcGiffing for your working, hope you are fine? We are waiting for the updated of the documentation.