Planning to use Web2py CAS as Authnication service for Tornado

75 views
Skip to first unread message

Phyo Arkar

unread,
Aug 14, 2014, 10:18:41 AM8/14/14
to web...@googlegroups.com
In our new application , it will be interactive Chat + Social Media/News/Forum discussion.
For most interactive part it will be done in Tornado , but for Non Interactive parts (Registration , Auth) I am going to use Web2py.
Database will be Mongodb.
We've used web2py extensively for past 5 years. But for interactive part Tornado is needed due to Long Polling and Websocket requirements.

Here are my Thoughts:

Home, Registration , Login = Web2py
Interactive discussion = Tornado
It will run on openshift with 3 instances.

1st  Gear:  uwsgi + web2py
2nd  Gear:  pypy + tornado
3rd  Gear:  Mongodb


Both will use Mongodb for database access.
What i wanted to know is:

I read about We2pyCAS with PHP , had anyone tried using Web2pyCAS for Tornado's Apps?
Can CAS Work well with Mongodb? ( I think it won't as theres no join for Mongodb).




Massimo Di Pierro

unread,
Aug 14, 2014, 1:11:11 PM8/14/14
to web...@googlegroups.com

Phyo Arkar

unread,
Sep 5, 2014, 4:12:51 PM9/5/14
to web2py
Thanks alot massimo, i haven't seen that.

class PostHandler(tornado.web.RequestHandler):
"""
only authorized parties can post messages
"""
def post(self):
if hmac_key and not 'signature' in self.request.arguments:
return None
if 'message' in self.request.arguments:
message = self.request.arguments['message'][0]
group = self.request.arguments.get('group', ['default'])[0]
print '%s:MESSAGE to %s:%s' % (time.time(), group, message)
if hmac_key:
signature = self.request.arguments['signature'][0]
if not hmac.new(hmac_key, message).hexdigest() == signature:
return None
for client in listeners.get(group, []):
client.write_message(message)
return None


Very useful!


--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups "web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages