示例#1
0
文件: web.py 项目: frabcus/webstore
def check_authentication():
    g.user = None
    if "REMOTE_USER" in request.environ:
        g.user = request.environ["REMOTE_USER"]
    if "Authorization" in request.headers:
        # If an authentication header is present, try to decode it
        # and pass it through the function AUTH_FUNCTION which is an
        # entry point named in the settings file.
        authorization = request.headers.get("Authorization")
        authorization = authorization.split(" ", 1)[-1]
        g.user, password = authorization.decode("base64").split(":", 1)
        check_function = entry_point_function(app.config["AUTH_FUNCTION"], "webstore.auth")
        if not check_function(g.user, password):
            # FIXME: we don't know the format yet.
            raise WebstoreException("Invalid username or password!", None, state="error", code=401)
示例#2
0
def check_authentication():
    check_function = entry_point_function(app.config['AUTH_FUNCTION'],
                                          'webstore.auth')
    g.user = check_function(request)
示例#3
0
文件: web.py 项目: rgrp/webstore
def check_authentication():
    check_function = entry_point_function(app.config['AUTH_FUNCTION'],
                                          'webstore.auth')
    g.user = check_function(request)
示例#4
0
def check_authentication():
    check_function = entry_point_function(app.config["AUTH_FUNCTION"], "webstore.auth")
    g.user = check_function(request)
示例#5
0
def has(user, database, action):
    has_function = entry_point_function(app.config['HAS_FUNCTION'],
                                        'webstore.authz')
    return has_function(user, database, action)
示例#6
0
def has(user, database, action):
    has_function = entry_point_function(app.config['HAS_FUNCTION'],
                                        'webstore.authz')
    return has_function(user, database, action)