def check_csrf_token():
    """
    Check token
    """
    from uliweb import request, settings

    token = (request.params.get(settings.CSRF.form_token_name, None) or
             request.headers.get("X-Xsrftoken") or
             request.headers.get("X-Csrftoken"))

    if not token:
        raise Forbidden("CSRF token missing.")
    if csrf_token() != token:
        raise Forbidden("CSRF token dismatched.")