Skip to main content

I'm developing a webapp with the flask framework as a backend and I need to provide authentication.

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.

The method I use is the win32security.LogonUserwin32security.LogonUser from pywin32pywin32 which returns a handle on successful login.

I have tried to understand how flask-login works, but the @login_manager.user_loader@login_manager.user_loader callback makes me confused.

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.

My User class looks like this:

class User(flask_login.UserMixin):
    def __init__(self,username):
        self.username = username
        self.id = ??? # What to use an id, and how could this id map back to this instance??

What to use an id, and how could this id map back to this instance?

I'm developing a webapp with the flask framework as a backend and I need to provide authentication.

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.

The method I use is the win32security.LogonUser from pywin32 which returns a handle on successful login.

I have tried to understand how flask-login works, but the @login_manager.user_loader callback makes me confused.

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.

My User class looks like this:

class User(flask_login.UserMixin):
    def __init__(self,username):
        self.username = username
        self.id = ??? # What to use an id, and how could this id map back to this instance??

I'm developing a webapp with the flask framework as a backend and I need to provide authentication.

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.

The method I use is the win32security.LogonUser from pywin32 which returns a handle on successful login.

I have tried to understand how flask-login works, but the @login_manager.user_loader callback makes me confused.

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.

My User class looks like this:

class User(flask_login.UserMixin):
    def __init__(self,username):
        self.username = username
        self.id = ??? 

What to use an id, and how could this id map back to this instance?

Source Link
monoceres
  • 4.8k
  • 4
  • 40
  • 66

Flask-login and LDAP

I'm developing a webapp with the flask framework as a backend and I need to provide authentication.

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.

The method I use is the win32security.LogonUser from pywin32 which returns a handle on successful login.

I have tried to understand how flask-login works, but the @login_manager.user_loader callback makes me confused.

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.

My User class looks like this:

class User(flask_login.UserMixin):
    def __init__(self,username):
        self.username = username
        self.id = ??? # What to use an id, and how could this id map back to this instance??