How do I add permissions to a NATS User to allow the User to query & create Jestream keyvalue stores?

Viewed 258

I have a User that needs to be able to query and create Jetstream keyvalue stores. I attempted to add pub/sub access to $JS.API.STREAM.INFO.* in order to give the User the ability to query and create keyvalue stores:

96f4d12cdd02:~# nsc edit user RequestCacheService --allow-pubsub "$JS.API.STREAM.INFO.*"
[ OK ] added pub pub ".API.STREAM.INFO.*"
[ OK ] added sub ".API.STREAM.INFO.*"
[ OK ] generated user creds file `/nsc/nkeys/creds/Client/Client/RequestCacheService.creds`
[ OK ] edited user "RequestCacheService"

As you can see above, pub sub was added for ".API.STREAM.INFO.", not "$JS.API.STREAM.INFO.".

How do I allow a User permissions to query & create Jetstream keyvalue stores?

1 Answers

Should be:

nsc edit user RequestCacheService --allow-pubsub '$JS.API.STREAM.INFO.*'

With single-quotes around the subject. I was under the impression that double & single quotes would escape the $ but apparently only single-quote will escape special characters in the subject.

Related