Override for RequiresAuthentication attribute? #459
-
|
If I set RequiresAuthentication on the service class, is there a way to allow anonymous access for individual methods, or will I need to move those into another service? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
|
I am unsure for that attribute. My recommendation is to to use the AspNetCore hosting and setup authentication and authorization so that you can use the aspnetcore attributes/configuration to handle authorization requirements, that way you can easily allow anonymous access for just a few endpoints (just make sure that submit requires authorization by requiring authorization on top/domainservice level). Example using attributes can be found on https://learn.microsoft.com/en-us/aspnet/core/security/authorization/simple?view=aspnetcore-7.0 |
Beta Was this translation helpful? Give feedback.
I am unsure for that attribute.
My recommendation is to to use the AspNetCore hosting and setup authentication and authorization so that you can use the aspnetcore attributes/configuration to handle authorization requirements, that way you can easily allow anonymous access for just a few endpoints (just make sure that submit requires authorization by requiring authorization on top/domainservice level).
Example using attributes can be found on https://learn.microsoft.com/en-us/aspnet/core/security/authorization/simple?view=aspnetcore-7.0