如何使用 django 验证 ejabberd?
How to authenticate ejabberd with django?
问题陈述
我有一个普通的 django 模型
Models.py
class Fan(models.Model):
user_id = models.CharField(unique=True, max_length=250)
...
...
问题 1
How do i authenticate ejabberd JID against this user_id
?
问题二
Which xmpp client (android and web) supports external ejabberd authentication?
我的方法
根据文档,我在
中进行了以下更改
ejabberd.yml
auth_method: external
extauth_program: "/home/niranj/Documents/entry.sh"
entry.sh
#!/bin/bash
workon orchestrator
/usr/bin/python /home/niranj/Documents/work.py $@
work.py
import sys
print sys.argv
Please note that i have provided ejabberd permission to access the files above
我总是在 ejabberd.log
中得到以下错误
2016-05-18 15:13:11.202 [critical] <0.411.0>@extauth:loop:142 extauth script has exitted abruptly with reason 'normal'
问题3
How do i solve this error? Anything wrong in this configuration?
我找到了问题 3、
的解决方案
work.py
import sys
while True:
print sys.argv
需要把循环做成无限循环这是这里的关键
由于这是固定的,所以我的 问题 1 也已固定,这很明显。
问题陈述
我有一个普通的 django 模型
Models.py
class Fan(models.Model):
user_id = models.CharField(unique=True, max_length=250)
...
...
问题 1
How do i authenticate ejabberd JID against this
user_id
?
问题二
Which xmpp client (android and web) supports external ejabberd authentication?
我的方法
根据文档,我在
中进行了以下更改ejabberd.yml
auth_method: external
extauth_program: "/home/niranj/Documents/entry.sh"
entry.sh
#!/bin/bash
workon orchestrator
/usr/bin/python /home/niranj/Documents/work.py $@
work.py
import sys
print sys.argv
Please note that i have provided ejabberd permission to access the files above
我总是在 ejabberd.log
中得到以下错误2016-05-18 15:13:11.202 [critical] <0.411.0>@extauth:loop:142 extauth script has exitted abruptly with reason 'normal'
问题3
How do i solve this error? Anything wrong in this configuration?
我找到了问题 3、
的解决方案work.py
import sys
while True:
print sys.argv
需要把循环做成无限循环这是这里的关键
由于这是固定的,所以我的 问题 1 也已固定,这很明显。