Return UserKeyCredential or UserPassCredential.

def getCredentials(self):
        """Return UserKeyCredential or UserPassCredential."""

        (username, password, public_key, private_key) = self.getCredentialValues()

        if public_key or private_key:
            return UserKeyCredential(username, public_key, private_key)

        if username or password:
            return UserPassCredential(username, password)

        return None