added support to return a list of group memberships

There seems to be a lot of copied code here with what exists in the authenticateUser one?

Also return null?