'Spring Security with external authentication

I have a working spring security that works againts a local db. Now I'd like to move the authentication part by calling a webservice as follow

RestTemplate rt = new RestTemplate();
        boolean valid = rt.getForObject(HostConfig.HOST+"/authenticate?username=hq&password=a123456",Boolean.class);

The above service returns true or false.

I'd like to know on which class I should override the existing authentication with the above. Any ideas?



Solution 1:[1]

org.springframework.security.core.userdetails.UserDetailsService is the thing that you are looking for. You should implement the method loadUserByUsername(), and check the password etc.

HTH

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 OhadR