Basic Authorization policy results and exception handling

The policy has no way to know what the name of your variable is in your function. It knows only what the contents of the variable is, and that’s null, because it doesn’t even exist. If you want your user class to also act as the identity class, you can implement the identity interface. Otherwise, what you have looks fine. Or, build a Policy to handle the Identity class and put the login check in there.

1 Like