Git Product home page Git Product logo

nest's Introduction

Hello, world! 我是 Liutos,一名钟爱 Common Lisp 的程序员。

尽管我最钟爱的是 Common Lisp,但我是从 C 语言开始接触编程的,入行后最先使用的是 Ruby,后来是 PHP、Node.js。现在则是 Python 和 Go。

但无论如何,最有意思的当然是 Common Lisp 了——尽管从来没有在工作中正经用过。

我写字的地方,欢迎订阅或关注

我的开源项目

Readme Card

Readme Card

技术栈

Top Langs

Liutos' github stats

nest's People

Contributors

liutos avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

nest's Issues

支持通过装饰器 authenticate 获得用户 ID

动机

目前获取用户 ID 的实现方式均为直接从 Cookie 中获取。例如,在文件nest/web/controller/change_location.py中,类HTTPParams的方法get_user_id就是这么实现的

    def get_user_id(self) -> int:
        return int(request.cookies.get('user_id'))

这样带来的问题是用户的身份只能通过 Cookie 来传递,必须通过请求接口POST /user/login来获得,进而无法很方便地实现 Basic Auth 这样的第二种认证身份的方式。

如果装饰器authenticate能够向被装饰的函数中传入认证成功的用户 ID,那么相应的IParams接口的实现类就可以与具体的认证方式解耦。今后要扩展更丰富的认证方式,只需要在authenticate的层面修改即可。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.