I am trying to integrate ejabberd with django authentication. I am following instructions on: https://github.com/ffalcinelli/django-ejabberd-bridge
I have followed every step.
I have defined the path of the script for authentication
{auth_method, external}.
{extauth_program, "script.sh"}. ( I have defined full path here )
Script file's content is :
#!/bin/bash
source <path>/env/bin/activate
python <path>/manage.py ejabberd_auth $#
My Problem is that I want ejjaberd to maintain the state of every user ( online , offline , away etc ). I think that whenever a user will login ( or logout ), that data needs to be sent to ejjaberd server. I tried to login and logout, but these users are not registering at ejabberd ( localhost:5280/admin )
I have tried this command from console :
python manage.py ejabberd_auth $#
It should ask me username and password. In the log file there is only one log :
2015-08-03 08:11:05,791 [DEBUG] ejabberd_bridge.management.commands.ejabberd_auth: Starting serving authentication requests for eJabberd
How can I send the user data to ejabberd?
You are expecting too much feature from that authentication module.
django-ejabberd-bridge purpose is to let ejabberd check authentication against Django authentication middleware, as described in project README:
Right now it just allows the ejabberd service to perform
authentication against Django's authentication middleware.
This has nothing to do with changing presence for example. That bridge will be use in that worklow:
a user want to log in ejabberd using XMPP client
ejabberd use external auth, thus your script for Django bridge to check if user and credentials are valid.
ejabberd use the result of the script to either accept or reject the user authentication request.
That's it. Presence and user state is still managed as usual with XMPP. While XMPP session is open, user will be seen as online. When XMPP client disconnect, user will be seen as offline by ejabberd, etc.
The user database is not duplicated. It is kept in the backend service. That's also the reason why user cannot be listed from the web interface: ejabberd does not handle them.
If you want only the presence of the user state, the django-ejabberd-bridge can manage it. you can see the online users in the web admin interface http://localhost:5280/admin/server/localhost/online-users/. But in your point of registering the user, the django-ejabberd-bridge doesn't do that. If you want to register the user from django to XMPP, then you should query it with the javascript libraries like converse.js, strophe.js etc.
I haven't tried registering the user using converse.js. Strophe provide the plugin called strophe.register.js for registering the users.
Related
I am using python flask to develop web services. I want to make web service secure.
Need to consume those from Ajax.
I have tried Okta integration but as it is depends on redirect I couldn't achieve the integration.
I am thinking to go for windows authentication with our org ldap directory.
Getting windows username and password from windows logged in user and authenticating with ldap.
Could anyone please help me how to achieve it or please post the suggestions for better solution.
You won't get the username and password from the Windows client -- being able to grab the logon user's password from a remote web site would be an enormous security nightmare.
Assuming not simply asking the user to supply credentials is a non-negotiable design parameter, you need something that can use the logged on user's token ('I trust this token and it says you are this user ID') instead of trying to validate the user/password directly. Kerberos-based authentication if the Windows boxes are logging into an Active Directory & your app is on the same network. Otherwise you'd need some sort of SSO (I frequently use ADFS, if that's set up for the organisation, via MS Graph) -- what would depend on the specifics of the directories available.
I have integrated ejabberd for chat functionality. Apps backend is in python-django and frontend is in IOS. current flow is as follows :
When user signup into my app, A record has been created for that user in ejabberd server. This thing is handled in backend. unique id for that user is the combination of primary key and name ( e.g - 123_mark#xyz.com )
To chat on frontend , IOS is using these id's. When both users are online , they can chat successfully.
Problem - When a user gets offline or a user kills the application, Then backend has to send notifications to device. I have checked ejjaberd's documentation. According to them I have to use mod_zeropush to send notifications. I have checked some articles, but I am not sure how to send notification to users. Can someone explain it in detail.
As far as I can see ZeroPush mod leverages a ZeroPush server, I might be wrong about this as I just glanced through their pages.
What you need to do is to create your own mod which hooks into events that are occurring in ejabberd. This Q&A sums it up: How to develop custom functions on top of Ejabberd?
Basically you need to find out which event is fired when a user disconnects and hook into that event so your mod would be executed.
I have a simple site made with python (django). User registers, inputs some basic info and it stores it to mysql. User then is able to log in with his username/password which he created...
Now i want to add a flex application which will run once the user is logged in, but i dont want the user to have to log in twice (once into django, once into flex app). For the sake of learning i just want the flex app to also load some information from the mysql database, like the users firstname or something.
So my question is how would i go about passing session information into the flex app? Any info or guidance, or opinion would be great.
If your Python/DJango app uses cookies for tracking sessions; then you just have to make sure that your SWF is served off the same domain that the Python app is served from.
The Flash Player will pass the appropriate cookies to the remote server whenever it makes a call to that server. As long as your "Flash Call" exists in the same Application space on the server, it should have access to the same session variables available on the server.
If you want to validate the user has logged in before loading the SWF; just make a remote call from the SWF to the server side to validate that the session exists, and the user is appropriately logged in. Don't activate any of the controls in the app until you get confirmation from the server that the user is allowed to use the app.
I using the Python SDK (http://github.com/facebook/python-sdk/) with Google app engine.
I can post message on user wall with the self.graph.put_object function while the user is online.
How do post a message to user wall directly from the server even the user is offline?
I am assuming you know how to kick the work off and just need the calls to authenticate for the user.
Your facebook app must request extended permissions from the user.
http://developers.facebook.com/docs/authentication/permissions
offline_access
Enables your application to perform
authorized requests on behalf of the
user at any time. By default, most
access tokens expire after a short
time period to ensure applications
only make requests on behalf of the
user when the are actively using the
application. This permission makes the
access token returned by our OAuth
endpoint long-lived. NOTE: If you have
requested the publish_stream
permission, you can publish content to
a user's feed at any time, without
requiring offline_access.
Once you have done this the oauth_access_token returned from Facebook is an offline_access token and can be used anytime until the user revokes your app access or extended permission.
I want to create an application that allows a user to register and login to a django application with an external provider. In addition, I then want the user to be able to associate additional accounts with that initial account. Finally, I would like the user to be able to login to the application with one of the other associated accounts.
So if a user initially signs in with Facebook Connect, I want them to be able to link their Google account. Then, if they log out, they can log in with their Google account (via openid) and it logs the user in as though they logged in via Facebook Connect.
Does anything like this exist already? Or do I need to write it myself?
The perfect solution for you seems to be Django-SocialAuth. See here. From the page:
Here is an app to allow logging in via twitter, facebook, openid, yahoo, google, which should work transparently with Django authentication system. (#login_required, User and other infrastructure work as expected.) Demo and Code
Edit: I'm pretty sure that SO uses django-SocialAuth for it's login system, looking at the project's demo page.