Use alternate authentication in twisted's Perspective Broker

主宰稳场 提交于 2020-01-03 03:40:09

问题


I am using twisted's Perspective Broker for a network application. I encountered the problem that it automatically uses an MD5 challenge-response scheme for authentication. Ideally I would prefer not to store MD5 hashes on the server-side due to a number of security vulnerabilities. Alternatively, scrypt, bcrypt or pbkdf2 provide more secure algorithms.

However, while these algorithms are readily available in python, I don't quite see, whether it is possible to implement a custom authentication scheme using the Perspective Broker. Judging from the source, it looks like MD5 is very tightly integrated within the system.

So my question goes to more experienced twisted users: is there a way to use a custom authentication scheme without having to rewrite the whole thing?

(Also, please correct me, if any of my assumptions about twisted or cryptography are wrong. I am quite new to both.)


回答1:


All you need to do in order to implement a custom authentication scheme for Perspective Broker is to implement a set of method calls on a root object which, after completion, provide access to your desired application-level object.

You won't be able to re-use PB's built-in login method and its accompanying wire-protocol messages, but that's fine; that's the thing you intend to replace anyway :).

Note that when you construct a PBServerFactory, you provide a root object. If you want to call methods on that object, rather than performing a "standard" PB login and calling methods on the returned avatar (i.e. per-user / per-connection object), call getRootObject on the PB client factory and use callRemote on the result.



来源:https://stackoverflow.com/questions/18959226/use-alternate-authentication-in-twisteds-perspective-broker

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!