See here for the Core class method to authenticate the user: https://apidocs.rnd.mendix.com/8/runtime/com/mendix/core/Core.html#authenticate(com.mendix.systemwideinterfaces.core.IContext,com.mendix.systemwideinterfaces.core.IUser,java.lang.String)
First retrieve the user to get the IUser and pass the password and context, the method retruns true if the authentication was succesful. In the Open AUthentication module there is a loinghelper class that can help you perform the complete login.
Hope this brings you a step closer to a solution for your use case.
You can also try with this module
for version 8 you need to upgrade the js snippet to 1.3