[Twisted-Python] Passing information from SSL postconnection check to application
Henrik Thostrup Jensen
thostrup at gmail.com
Tue Dec 5 05:19:42 MST 2006
Hi
I have an application which uses M2Crypto authentication. I use the
wrapper supplied by M2Crypto, and can do postConnection check just
fine. I need to pass along some of the information from the client
credentials, but I cannot figure out how to do this.
The code looks something like this:
from twisted.application import service, internet
from twisted.protocols import policies
from M2Crypto import SSL
from M2Crypto.SSL.TwistedProtocolWrapper import TLSProtocolWrapper
def protocol_factory(factory, wrapped_protocol):
wrapper = TLSProtocolWrapper(factory,
wrapped_protocol,
startPassThrough=0,
client=0,
contextFactory=ServerContextFactory(),
postConnectionCheck=MyChecker())
return wrapper
factory = ...
wrapper = policies.WrappingFactory(factory)
wrapper.protocol = protocol_factory
wrapper.protocol.TLS = True
factory.startTLS = True
factory.sslChecker = SSL.Checker.Checker()
factory = wrapper
application = service.Application('foo')
service = internet.TCPServer(8443, factory)
service.setServiceParent(application)
Currently the original factory is the factory from twisted.web2, but
I would like to be able to do this, on a general level, e.g., from AMP
as well. Setting the information into some global value is sure to fail,
but I cannot see how else to propagate information.
--
- Henrik
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/twisted-python/attachments/20061205/eabea516/attachment.html>
More information about the Twisted-Python
mailing list