[web2py] Re: Applications sharing auth tables - problem

2011-09-23 Thread Cliff
 Has anyone implemented single sign on functionality?

If this has a bug I'll report it here, but it appears to be working:

Move all of your application-specific table defs out of db.py if you
haven't already done so.  This should leave you with the basic
application setup and auth file generation.
Your applications will all have to share user_auth, at least.

All your apps have to share the tables.  If you're using sqlite, each
app by default has a unique set of tables.  Since I use *nix boxen, I
guess I could have softlinked the database directories to the table
files in the master app's database directory.  Since I'm going to use
Postgresql in production, I just switched to it.

Thanks to Massimo or whoever wrote the steps for using Postgresql, by
the way.  Worked like a charm.

In your master app's db.py file, add a session.connect() as described
in chapter 4 of the book, under 'Cooperation.'  I have it right after
the line of code that instantiates db.

Do the same thing in each of your other db.py files.

Then add these lines of code underneath it:
if not session.auth:
session.original_request = {
'application': request.application,
'controller': request.controller,
'function': request.function,
'args': request.args,
'vars': request.vars
}
redirect(URL('welcome', 'default', 'user/login'))

Notice I am using the welcome app as my master.  This I will change
today because otherwise upgrades will cause a problem.

In the welcome app, the login function redirects to welcome/default/
index

I put these lines of code at the very top if the index function:

if session.original_request:
destination = URL(
session.original_request['application'],
session.original_request['controller'],
session.original_request['function'],
args = session.original_request['args'],
vars = session.original_request['vars'],
)
del session['original_request']
redirect(destination)



On Sep 21, 2:07 pm, pbreit pbreitenb...@gmail.com wrote:
 Has anyone implemented single sign on functionality? That might be a good
 utility to have available.


[web2py] Re: Applications sharing auth tables - problem

2011-09-21 Thread pbreit
Has anyone implemented single sign on functionality? That might be a good 
utility to have available.

Re: [web2py] Re: Applications sharing auth tables - problem

2011-09-21 Thread Bruno Rocha
There is CAS, but it actually has a bug.


[web2py] Re: Applications sharing auth tables - problem

2011-09-21 Thread Massimo Di Pierro
I am not aware of a CAS bug? tell us more.

On Sep 21, 1:41 pm, Bruno Rocha rochacbr...@gmail.com wrote:
 There is CAS, but it actually has a bug.


Re: [web2py] Re: Applications sharing auth tables - problem

2011-09-21 Thread Bruno Rocha
On Wed, Sep 21, 2011 at 7:01 PM, Massimo Di Pierro 
massimo.dipie...@gmail.com wrote:

 I am not aware of a CAS bug? tell us more.


Look this thread:
https://groups.google.com/forum/#!topic/web2py/FhtokyNZT7k/discussion

CAS enters in redirect loop.


Re: [web2py] Re: Applications sharing auth tables - problem

2011-09-21 Thread Anthony
Yes, the loop seems to happen when you have a custom auth_user table (even 
if it's exactly the same as the standard auth_user table definition).

Anthony

On Wednesday, September 21, 2011 7:20:54 PM UTC-4, rochacbruno wrote:

 On Wed, Sep 21, 2011 at 7:01 PM, Massimo Di Pierro 
 massimo@gmail.comwrote:

 I am not aware of a CAS bug? tell us more.

  
 Look this thread: 
 https://groups.google.com/forum/#!topic/web2py/FhtokyNZT7k/discussion

 CAS enters in redirect loop.



Re: [web2py] Re: Applications sharing auth tables - problem

2011-09-21 Thread Martín Mulone
Please if it's a bug: Open a ticket.

2011/9/21 Anthony abasta...@gmail.com

 Yes, the loop seems to happen when you have a custom auth_user table (even
 if it's exactly the same as the standard auth_user table definition).

 Anthony

 On Wednesday, September 21, 2011 7:20:54 PM UTC-4, rochacbruno wrote:

 On Wed, Sep 21, 2011 at 7:01 PM, Massimo Di Pierro massimo@gmail.com
  wrote:

 I am not aware of a CAS bug? tell us more.


 Look this thread: https://groups.google.**com/forum/#!topic/web2py/**
 FhtokyNZT7k/discussionhttps://groups.google.com/forum/#!topic/web2py/FhtokyNZT7k/discussion

 CAS enters in redirect loop.




-- 
 http://martin.tecnodoc.com.ar