ladon + django

Asked by romankrv

Hi.
Exist or not integration solution with django?
How use django authenticate orm etc with ladon?

Thanks

Question information

Language:
English Edit question
Status:
Solved
For:
ladon Edit question
Assignee:
jsgaarde Edit question
Last query:
Last reply:
Revision history for this message
jsgaarde (jakob-simon-gaarde) said :
#1

Hi Romankrv

Thanks for all your feedback :-)

There is no django integration. Ladon is a low-level web service for developers that do not want their hands tied to specific flowclasses and being forced to do things in a certain way. So you can think of Ladon as being a fundament that you can build on. You can easily create a new package (ie a package for PyPI) that depends on Ladon to bridge SOAP and JSON-WSP to django.

There are several ways to create authentication into a Ladon service. It depends on what you are doing.
1. You can setup a https site and let the webserver handle authentication. This is a well-known safe method - in short the idea is to setup ssl-encryption on your webserver (https) and then protect your virtual host or virtual host directory with some kind of authentication module (ie if you are using Apache2 as webserver: mod_auth_mysql). When the user has authenticated the server variable REMOTE_USER will contain the username and is safe to use.

2. Enable ssl-encryption on your webserver and implement your own authentication service class using a DB or password file as backend. When the user is authenticated send back a time limited session-id mapped to the authenticated user to keep track of who is logged in. I have used this method a couple of times and it works very well. I always use memcached to keep track of sessions, it's ideal cause you can store time limited data on the memcache server.

I have put a snippet of code on pastebin:
http://paste.ubuntu.com/652330/

Hopefully it can give you an idea of how I have implemented authentication in a shopservice some months ago. It won't import directly on your computer as I haven't pasted the customermanager module which is basically a module that does all customer related communication with the back-end DB.

Hope this helps :-)

Best regards
Jakob Simon-Gaarde

Revision history for this message
romankrv (romankrv) said :
#2

Hi Jakob
Could you please share CustomerManager if it possible at least the skeleton of code

Thanks

Revision history for this message
jsgaarde (jakob-simon-gaarde) said :
#3

I will look at it later. I am busy until tonight (danish time) :-)
Den 26/07/2011 12.56 skrev "romankrv" <<email address hidden>
>:
> Question #166016 on ladon changed:
> https://answers.launchpad.net/ladon/+question/166016
>
> Status: Answered => Open
>
> romankrv is still having a problem:
> Hi Jakob
> Could you please share CustomerManager if it possible at least the
skeleton of code
>
> Thanks
>
> --
> You received this question notification because you are an answer
> contact for ladon.

Revision history for this message
jsgaarde (jakob-simon-gaarde) said :
#4

Import comments:
* getConnection returns a psycopg2 connection
* nextCommonId fetches the next thread-safe sequence ID

They work exactly like the two static methods with the same name in the sessionservice module.

http://paste.ubuntu.com/652446/

Best regards
Jakob Simon-Gaarde

Revision history for this message
romankrv (romankrv) said :
#5

also what about getConnection and nextCommonId in:

from limbosoft.tools.dbconnector import getConnection,nextCommonId

Thanks

Revision history for this message
jsgaarde (jakob-simon-gaarde) said :
#6

They work exactly like the two static methods with the same name in the sessionservice module.

Revision history for this message
jsgaarde (jakob-simon-gaarde) said :
#7

And this one, can you give that a closing status?

Revision history for this message
jsgaarde (jakob-simon-gaarde) said :
#8

I'm setting this to solved, so other people can benefit from the info.