title: Flask-security: where does "current_user" comes form?
body: <p>This is most probably a stupid question, but still I can't find an answer.</p>
  
  <p><a href="https://pythonhosted.org/Flask-Security/api.html" rel="nofollow noreferrer">Documentation</a> for Flask-Security says:</p>
  
  <blockquote>
    <p>If there are only certain times you need to require that your user is logged in, you can do so with:</p>
  </blockquote>
  
  <pre><code>if not current_user.is_authenticated:
    return current_app.login_manager.unauthorized()
  </code></pre>
  
  <p>But it gives no clue where this "current_user" variable shall come from. Not surprisingly I get a "NameError: global name 'current_user' is not defined" when I try to use it in my application source code.</p>
  
  <p>Weird thing is that, when I use the variable in my HTML template, <strong>render_template</strong> function somehow completes without an error.</p>
  
  <p>So, the question is, how can I use "current_user" variable in my application and how does the template engine "know" about it if my app doesn't?</p>