1

Hello FIWARE specialists, I like to create a subscription, which pushes notifications to an external service. The external service needs authorization with a barrier token. If I use curl, I add "--header 'Authorization: Bearer XXX'". How can I add a barrier token to the subscription request?

"notification": {
    "attributes": [ "id", "type", "name", "location", "occupancy"],
    "format": "normalized",
    "endpoint": { 
        "uri": "http://a.b.c.de:1111", 
        "accept": "application/json"
    }
  },

Is there an option to add a header field to the "endpoint" setup in the subscription like:

"headers": "Authorization: Bearer XXX"

Hopefully, you can help me in that case. Thanks, Knigge

fgalan
  • 11,732
  • 9
  • 46
  • 89
knigge
  • 31
  • 3
  • If you could reformulate the question in NGSIv2 terms (maybe in a separate post) I can provide you some answer. – fgalan Sep 12 '22 at 17:24
  • 1
    so I try to reformulate my question in NGSIv2 context ... I like to create a subscription, which pushes notifications to an external service. The external service needs authorization with a barrier token. How can I add a barrier token to the body when I create a subscription? If I create a subscription via "notification": { "http": { "url": "http://context-provider:3000/subscription/low-stock-store001", "headers": "Authorization: Bearer XXX" }, "attrsFormat" : "keyValues" } the creations seem successful. – knigge Sep 21 '22 at 12:20
  • If I request the subscription again, the "headers" entry is not inside anymore, so it was not saved. What is the right way to implement the Bearer Token in the subscription definition? – knigge Sep 21 '22 at 12:26
  • Is this problem detected in Orion or Orion-LD? I have the impression it's Orion-LD and in such case it's a bug of mine. If so, please create an issue on Orion-LD's github, as detailed as possible: https://github.com/FIWARE/context.Orion-LD/issues – kzangeli Sep 22 '22 at 07:47

1 Answers1

0

In Orion Context Broker using the NGSIv2 API you can use custom notifications to achieve that. For example the following subscription:

...
"httpCustom": {
  "url": "http://context-provider:3000/subscription/low-stock-store001",
  "headers": {
    "Authorization": "Bearer XXX"
  }
}
fgalan
  • 11,732
  • 9
  • 46
  • 89