示例#1
0
    def authorization_checker(*args, **kwargs):
        token = request.headers.get("Authorization-Token")
        if not token:
            token = request.args.get("auth_token")
            if not token:
                return jsonify(error="No authorization token provided.")

        uni = db.get_uni_for_code(g.cursor, token)
        if not uni:
            return jsonify(error="Invalid authorization token.")

        # TODO: Some logging right here. We can log which user is using what.
        return func(*args, **kwargs)
示例#2
0
    def authorization_checker(*args, **kwargs):
        token = request.headers.get('Authorization-Token')
        if not token:
            token = request.args.get('auth_token')
            if not token:
                return jsonify(error="No authorization token provided.")

        uni = db.get_uni_for_code(g.cursor, token)
        if not uni:
            return jsonify(error="Invalid authorization token.")

        # TODO: Some logging right here. We can log which user is using what.
        return func(*args, **kwargs)
示例#3
0
    def authorization_checker(*args, **kwargs):
        token = request.headers.get('Authorization-Token')
        if not token:
            token = request.args.get('auth_token')
            if not token:
                response = jsonify(error="No authorization token provided")
                response.status_code = 401      # unauthorized
                return response

        uni = db.get_uni_for_code(g.cursor, token)
        if not uni:
            response = jsonify(error="No authorization token provided")
            response.status_code = 401          # unauthorized
            return response

        # TODO: Some logging right here. We can log which user is using what.
        return func(*args, **kwargs)