If you need to use several properties to authenticate user with Spring Security, for example, by login and domain, there is no built-in way to do it. Even when you override UserDetailsService it only calls method with one username parameter.
Fortunately, there is easy way to access request context with Grails, so it is possible to extract any parameter you need, like:
Fortunately, there is easy way to access request context with Grails, so it is possible to extract any parameter you need, like:
import org.springframework.web.context.request.RequestContextHolder
class UserDetailsService implements GrailsUserDetailsService {
UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
def otherParameter = RequestContextHolder.requestAttributes.params.other
...
}
}
I am getting null pointer exception if I use this.
ReplyDeleteVijay Satlawar