See my suggestion from above:
If you use laminas-authentication then the identity helps here. Here is an example: