Atlassian Confluence Webhook没有调用Play!使用Atlassian Connect Plugin的方法

时间:2014-02-19 13:50:26

标签: playframework-2.0 confluence atlassian-connect

我正在尝试使用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"
            }
        ]
    }
}

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

这是来自Play!的路线文件的片段,对应于网址:

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和所有示例的文档,但仍然无处可去。我注意到Athpenan Answers在webhooks上有许多未解答的问题 - 希望这个问题会得到一个!

1 个答案:

答案 0 :(得分:2)

游戏!应用程序的方法从未被调用,因为它受到自己的身份验证机制的保护,即该方法具有注释@Security.Authenticated(Secured.class)

来自Confluence的请求需要JWT身份验证。