简体   繁体   English

使用 URL 创建订阅,包括 header 中的不记名令牌

[英]Create subscription with URL including Bearer Token in the header

Hello FIWARE specialists, I like to create a subscription, which pushes notifications to an external service. FIWARE 专家您好,我喜欢创建一个订阅,它将通知推送到外部服务。 The external service needs authorization with a barrier token.外部服务需要使用屏障令牌进行授权。 If I use curl, I add "--header 'Authorization: Bearer XXX'".如果我使用 curl,我添加“--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:是否可以选择将 header 字段添加到订阅中的“端点”设置,例如:

"headers": "Authorization: Bearer XXX"

Hopefully, you can help me in that case.希望你能在这种情况下帮助我。 Thanks, Knigge谢谢, 尼格

In Orion Context Broker using the NGSIv2 API you can use custom notifications to achieve that.在使用 NGSIv2 API 的 Orion Context Broker 中,您可以使用自定义通知来实现这一点。 For example the following subscription:例如以下订阅:

...
"httpCustom": {
  "url": "http://context-provider:3000/subscription/low-stock-store001",
  "headers": {
    "Authorization": "Bearer XXX"
  }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM