Do you have an issue with 'getPrincipalByUniqueName'?
HINTS
What is the identity type?
A principal could either be a user, a role, or a group. The unique name does not specify the type of the principal. Thus you need to manually provide the specific type in order to get the right value returned. Possible values are 'user', 'group' and 'role'.