What I am trying to do is something functionally like this (of course, the code below is nonsense):
@UseGuards( AuthGuard || AdminAuthGuard )
I want my guards to be false only if both return false. Basically, I'd like my auth guards to be like an OR statements because the endpoint can be activated by multiple independent sources and each has its own authentication system.
Of course, I could combine those two auths in the same function. The problem is that the code would become messy as there are instance where I need to use each of them individually and I do not want an overlap with one another.
Anyone has any idea how to implement a behavior like that?
PS: Also, as additional complexity, I am using RoleGuards with one of the two login system. So RoleGuards would be applied, for example, if AdminAuth is true, but not apply is normal Auth is true.
SOLUTION: Here's how I solved this problem(I still don't know if there's a simple nestjs way of doing it. If you you, I want to know ;)). In my original guards, I exported the validateRequest function. I created an auth guard that is called adminOrNormalAuthGuard. In there I import the functions and implement the logic I want.
As for the roleGuards, all that I'm doing is importing those validate functions. If login is normal=> return true. If special login=> result depends on guards logic.