且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在龙卷风的WebSocket应用程序的用户身份验证

更新时间:2023-12-04 18:11:52

我建议你阅读概述部分的文件中。

I suggest you read the overview section in the documentation.

应该有一些相关的内容有:

There should be some relevant content there:

  • Cookies and secure cookies
  • User Authentication
  • Third Party Authentication

修改

我才意识到你的问题是关于WebSockets的。我相信你可以使用你勾勒出的方法:

I just realized your question is about websockets. I believe you can use the approach you outline:


  • 创建你的应用程序的非WebSocket的一部分,一个cookie

  • 检查Cookie中的WebSocket处理器

您应该可以使用访问WebSocket的处理程序中请求头 self.request.headers

You should be able to access the request headers inside the websocket handler using self.request.headers.