How to get the WindowsAuthenticationToken object in Waffle with Spring Security 6?

31 views
Skip to first unread message

Mobile Visuals

unread,
Oct 22, 2024, 10:30:21 AM10/22/24
to waffle

I updated our webb app to Spring Security 6. The central object for the authentication is the WindowsAuthenticationToken.

It is from here that we get the users name and the WindowsPrincipal object, which we then get the AD-group name from. This is how we get the WindowsAuthenticationToken:

auth = (WindowsAuthenticationToken) SecurityContextHolder.getContext().getAuthentication();

But this no longer works with Spring Security 6, since the Authentication object  returned by getAuthentication() is not an instance of WindowsAuthenticationToken. So can we get or create WindowsAuthenticationToken object with Spring Security 6?  Our Waffle code is based on this project, but updated to Spring Security 6: https://github.com/mgoldgeier/waffle-spring-boot-demo

Reply all
Reply to author
Forward
0 new messages