title: Flask-login and LDAP
body: <p>I'm developing a webapp with the flask framework as a backend and I need to provide authentication.</p>
  
  <p>Since this is an in-house app to be used on our local domain I have chosen to authenticate user with their already present domain credentials.</p>
  
  <p>The method I use is the <code>win32security.LogonUser</code> from <code>pywin32</code> which returns a handle on successful login.</p>
  
  <p>I have tried to understand how flask-login works, but the <code>@login_manager.user_loader</code> callback makes me confused.</p>
  
  <p>It says I should provide an id which can be used to reload the user, however I have no database or persistent storage to provide this mapping from, since I'm only interesting in checking if the user pass authentication.</p>
  
  <p>My User class looks like this:</p>
  
  <pre><code>class User(flask_login.UserMixin):
      def __init__(self,username):
          self.username = username
          self.id = ??? 
  </code></pre>
  
  <p>What to use an <code>id</code>, and how could this id map back to this instance?</p>