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)
def check_authentication(): check_function = entry_point_function(app.config['AUTH_FUNCTION'], 'webstore.auth') g.user = check_function(request)
def check_authentication(): check_function = entry_point_function(app.config["AUTH_FUNCTION"], "webstore.auth") g.user = check_function(request)
def has(user, database, action): has_function = entry_point_function(app.config['HAS_FUNCTION'], 'webstore.authz') return has_function(user, database, action)