DEV Community

Shihab Abrar Hossain
Shihab Abrar Hossain

Posted on

Spring Boot LDAP and Local Database

I am getting this error:

java.lang.ClassCastException: org.springframework.security.ldap.userdetails.LdapUserDetailsImpl cannot be cast to com.rnd.geo.web.dto.CustomUser
Enter fullscreen mode Exit fullscreen mode

I could login via my ldap username and password but after login i cant move to my home page due to the mentioned error.

Here, CustomUser is my user class that implements UserDetails.

Thanks

Top comments (1)

Collapse
 
shihababrar profile image
Shihab Abrar Hossain

I have Solved my problem using a custom CustomLdapUserDetailsMapper Class that extends LdapUserDetailsMapper. Then finally I have wrapped it on userDetailsContextMapper in my webSecurityConfig.