Open jirikanda opened 5 months ago
Probably due to the [ApiContract]
attribute on IOfferFacade
, where the default RequireAuthorization
property default is true
.
Currently, with the way we register the gRPC services in startup code, we do not expect to have both authorized and anonymous methods on single facade. You can still remove the RequireAuthorization()
call from the gRPC registration in MapGrpcServicesByApiContractAttributes()
(configureEndpointWithAuthorization
action) which will remove the default "fallback authorization = require the user to be at least authenticated" and rely solely on the [Authorize]
attributes on the facade itself.
The original purpose of the RequireAuthorization
property on [ApiContract]
attribute was to allow a simple decision on client-side whether to require a JWT token to be added to the server calls:
https://github.com/havit/NewProjectTemplate-Blazor/blob/58e7c29c827f079975629af75a8529db6cd8d7ea/Web.Client/Program.cs#L100-L104
...with the new BWA and cookie-based auth, we can drop the JWT token support (can we?) and remove the [ApiContact(RequireAuthorization = ...)]
property. Breaking change.
we do not expect to have both authorized and anonymous methods on single facade
OK, so the only possible way is to make IOfferFacade
and IOfferFacadeWithAnonymousAccess
?
(I am not sure now if it be implemented with just one class.)
...with the new BWA and cookie-based auth, we can drop the JWT token support (can we?) and remove the
We can. For the BWA (we have removed the nuget package from the application with this support).
AllowAnonymousAttribute on a single method is ignored: