Using local CAS provider with app in the same web2py instance

5 views
Skip to first unread message

dvid

unread,
Apr 23, 2009, 6:49:28 PM4/23/09
to web2py Web Framework, da...@zejda.net
I added the CAS service provider as a "cas" application to my web2py,
changed db to MySQL and configured email.py. Itself it seems to work,
or at least, there are no errors reported. I can successfully
register, login, logout, change password.

But I'm doing something wrong, when trying to use it as a provider in
the separate app called jfind.

I added the cas.py to the jfind models without modifications.

Currently, my controller called "users" in the jfind app begins with:

CAS.login_url='%s/cas/cas/login' % (HOST)
CAS.check_url='%s/cas/cas/check' % (HOST)
CAS.logout_url='%s/cas/cas/logout' % (HOST)
CAS.my_url='%s/%s/users/login' % (HOST,request.application)

def login():
session.token=CAS.login(request)
id,email,name=session.token
return dict()
...

Now the login function, instead of HTML with something more
meaningful, generates only:

You are being redirected <a href="localhost:8000/cas/cas/login?
service=localhost:8000/jfind/users/login">here</a>

Please, what I'm missing?

Thanks!

mdipierro

unread,
Apr 24, 2009, 3:54:50 PM4/24/09
to web2py Web Framework
In one of the model files you need to setup HOST, this is something
like "http://hostname:port" as visible by your authentication
provider. web2py does not always gets it right because may be running
behind a proxy.

Massimo

David Zejda

unread,
Apr 26, 2009, 5:59:40 PM4/26/09
to web...@googlegroups.com
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Massimo, thanks.

Now, if I try the exposed login controller in my application, I'm
getting ticket with

id,email,name=session.token
TypeError: 'NoneType' object is not iterable

instead of login page being shown.

In CAS.login_url there is a http://localhost:8000/cas/cas/login, which
is correct - on this URL there a functional CAS login page sits.

Should I do something more in the application, than to

1) add unmodified cas.py to the models
2) set the CAS.login_url, CAS.check_url, CAS.logout_url and CAS.my_url
3) expose the login()
?

BTW the CAS.my_url contains link to the login() exposed above, I hope,
this is correct.

With regards,

David

mdipierro napsal(a):

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkn02UsACgkQ3oCkkciamVG2YQCgqQvX+LQx8LJ135T1ihlWfJ98
cbkAn2f+uOCP4/DrAwOs17Gg7jlUmev3
=x77y
-----END PGP SIGNATURE-----

Reply all
Reply to author
Forward
0 new messages