I am creating a custom authentication service in my spring mvc application:
@Service
public class AuthenticationServiceImpl implements AuthenticationService {
@Autowired
UserService userService;
@Override
public void login(String email, String password) {
boolean isValid = userService.isValidLogin(email, password);
if(isValid) {
// ??? create a session cookie and add to http response
}
}
}
How can I create and add the cookie to the response?
In Spring MVC you get the HtppServletResponce object by default .