相关疑难解决方法(0)

Bottle 中的基本身份验证

如何在 Bottle 框架中执行基本身份验证?在烧瓶中我曾经:

def check( username, password ):
    # This function is called to check if a username/password combination is valid
    return username == 'nikos' and password == '******'


def authenticate():
    # Sends a 401 response that enables basic auth
    return Response( 'Credentials of a registered user required!', 401, {'WWW-Authenticate': 'Basic realm="User!"'} )
Run Code Online (Sandbox Code Playgroud)

并称为:

auth = request.authorization
if not auth or not counters.check( auth.username, auth.password ):
    return counters.authenticate()
Run Code Online (Sandbox Code Playgroud)

我如何在 Bottle 框架中实现相同的目标?

python bottle

3
推荐指数
1
解决办法
3388
查看次数

如何使用Python实现用户身份验证和会话

可能重复:对
瓶子友好的WSGI身份验证库/中间件

我正在使用Python和Bottle创建一个简单的Web应用程序.将此用户身份验证/会话添加到此设置的简单方法是什么?

python authentication session web-applications bottle

1
推荐指数
1
解决办法
4725
查看次数