2

我正在尝试使用 webhook(登录事件)来调用我的 Play!应用程序。我需要将该用户的用户和 IP 地址传递给该方法,但出现此错误:

[httpclient-callbacks:thread-37]          
[atlassian.webhooks.plugin.PublishTaskFactoryImpl$PublishTaskImpl] apply Unable to post the information to http://<host>:9000/geoip/login due to null

我不知道什么是 null 并且没有足够的文档来找出原因?请帮忙。

atlassian-connect.json

{
    "baseUrl": "${localBaseUrl}",
    "key": "confluence-webhook",
    "authentication": {
        "type": "jwt"
    },
    "vendor": {
        "name": "Wikistrat",
        "url": "http://www.wikistrat.com"
    },
    "description": "Atlassian Connect add-on that connects to GeoIP2",
    "name": "GeoIP2",
    "lifecycle": {
        "installed": "/installed",
        "uninstalled": "/uninstalled"
    },
    "scopes": [ "READ", "WRITE" ],
    "modules": {
        "webhooks": [
            {    
         "key": "confluence-webhook",
                 "event": "login",
                 "url": "geoip/login"
            }
        ]
    }
}

我对参数进行了硬编码,因为我不知道如何包含变量。

这是 Play! 的路由文件中与 url 对应的片段:

POST /geoip/login controllers.GeoIp.getLocation()

getLocation()方法读取参数并执行其工作。

登录 Confluence 时出现此错误...\Atlassian Run Standalone\amps-standalone\target\confluence-LATEST.log(应该会触发 webhook):

2014-02-19 13:21:11,175 WARN [httpclient-callbacks:thread-29]   
[atlassian.webhooks.plugin.PublishTaskFactoryImpl$PublishTaskImpl] apply Unable to post the information to http://<host>:9000/geoip/login due to null

app.js正在运行节点(端口 3000),它会产生以下输出:

login
{    timestamp: 1392816071138,
     remoteIP: '0:0:0:0:0:0:0:1',
     user: 'savbalac',
     remoteHost: '0:0:0:0:0:0:0:1' }
POST /login 204 37ms

这在confluence-latest.log

2014-02-19 13:21:11,176 WARN [httpclient-callbacks:thread-29] 
[atlassian.webhooks.plugin.PublishTaskFactoryImpl$PublishTaskImpl] apply Unable to post the information to http://<host>:3000/login due to null

我已经打开了管理页面中的所有日志记录,我已经阅读了有关 Webhooks 和所有示例的文档,但仍然一无所获。我注意到 webhook 上的 Atlassian Answers 中有许多未解答的问题 - 希望这个问题能得到解答!

4

1 回答 1

2

The Play! app's method was never called because it was protected by its own authentication mechanism, i.e. the method had annotation @Security.Authenticated(Secured.class).

Requests from Confluence need JWT authentication instead.

于 2014-02-20T15:14:52.670 回答