Restrict service to MessageQueue only

I’m trying to restrict access to a service so it can only be called via a MQ, not HTTP. I’ve decorated the Request DTO with [Restrict(RequestAttributes.MessageQueue)] to try to achieve this but it doesn’t prevent HTTP access.

Having had a browse around the source code I found the ToAllowedFlagsSet method and found that:

RequestAttributes.MessageQueue.ToAllowedFlagsSet() has a value of MessageQueue | Any

I believe this is because RequestAttributes.Any doesn’t include RequestAttributes.AnyEndpoint

If this is not a bug, is there a different way of preventing HTTP access to a service.

RequestAttributes.Any should include AnyEndpoint although the issue was that the RequestAttributes.Http request attribute needed to be added to all HTTP Request contexts which I’ve added in this commit.

This change is available from v5.0.3 that’s now available on MyGet.

1 Like