Pimcore password datatype in class

I am trying to use pimcore password datatype, it’s working fine and password is stored as encrypted data. Now i need to check the correct username and password. I couldn’t match the encrypted password. I means, will get the username and password as api request, if the username and password is correct then return value.

Never done this myself, but perhaps you can find something in the members bundle.