简体   繁体   English

如何在python的Twisted客户端服务器应用程序中添加身份验证(用户名/密码)?

[英]How to add authentication(Username/Password) in Twisted client server application in python?

I have managed to built a simple client server application in Twisted that takes the data from the serial port and send it to the server. 我已经设法在Twisted中构建了一个简单的客户端服务器应用程序,该应用程序从串行端口获取数据并将其发送到服务器。 I want to know how i can add any kind of authentication for accessing the server. 我想知道如何添加用于访问服务器的任何身份验证。 Right now anyone with the server IP can send data to the server. 现在,拥有服务器IP的任何人都可以将数据发送到服务器。 Any help would be highly appreciated . 任何帮助将不胜感激。

I can redirect you to this question . 我可以将您重定向到这个问题

Basically, you need to implement a protocol client & server sides that parses username and password, validates them and keeps the connection open / routes it to a new address, or closes it. 基本上,您需要实现一个协议客户端和服务器端,以解析用户名和密码,对其进行验证并保持连接打开/将其路由到新地址或将其关闭。 Lower level approaches are also possible, but way more complicated. 也可以使用较低级别的方法,但是方法更复杂。

Twisted has an SSL auth built in , if it is of any interest to you. Twisted内置了SSL身份验证 ,如果您有兴趣的话。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM