RootCauseunvalidated
The loadUserByUsername contract returns UserDetails, but the implementation returns Spring’s org.springframework.security.core.userdetails.User, which cannot be cast to the application’s User/Admin types. With a single authentication flow/config, Spring ends up invoking the same UserDetailsService behavior rather than separate handlers per endpoint.
eec87f50-5182-43ee-9731-14519c63cc17
The loadUserByUsername contract returns UserDetails, but the implementation returns Spring’s org.springframework.security.core.userdetails.User, which cannot be cast to the application’s User/Admin types. With a single authentication flow/config, Spring ends up invoking the same UserDetailsService behavior rather than separate handlers per endpoint.