Authentication: Difference between revisions
Jump to navigation
Jump to search
(Initial page for modular authentication) |
|||
Line 2: | Line 2: | ||
To make our auth(entication) system more modular, we're likely going to have some sort of interface style API for it. This page is to design it. |
To make our auth(entication) system more modular, we're likely going to have some sort of interface style API for it. This page is to design it. |
||
== __init__.py Base Class == |
|||
***This is a brainstorm of some of the functions and variables that the base class should include.*** |
|||
basic_auth = False # Will be used to render to correct forms if using both basic_auth and openid/persona |
|||
login_form = # Plugin LoginForm class |
|||
registration_form = # Plugin RegistrationForm class |
|||
class UserAuthInterface(object): |
|||
<nowiki> |
|||
deg _raise_not_implemented(self): |
|||
# Will raise a warning if some component of this interface isn't implemented by an Auth plugin |
|||
def check_login(self, user, password): |
|||
return False |
|||
def get_user(self, *args): |
|||
# Will query database and will return a User() object |
|||
def create_user(self, *args): |
|||
# Will create a new user and save to the db. |
|||
# Will return User() object |
|||
def extra_validation(self, register_form, *args): |
|||
# Will query the db and add error messages to register_form if any. |
|||
# return true if able to create new user |
|||
def get_user_metadata(self, user): |
|||
# Return a nice object with metadata from auth provider. Used to pre-fill registration forms |
|||
</nowiki> |
Revision as of 23:09, 30 April 2013
Designing Authentication API
To make our auth(entication) system more modular, we're likely going to have some sort of interface style API for it. This page is to design it.
__init__.py Base Class
- This is a brainstorm of some of the functions and variables that the base class should include.***
basic_auth = False # Will be used to render to correct forms if using both basic_auth and openid/persona
login_form = # Plugin LoginForm class
registration_form = # Plugin RegistrationForm class
class UserAuthInterface(object): deg _raise_not_implemented(self): # Will raise a warning if some component of this interface isn't implemented by an Auth plugin def check_login(self, user, password): return False def get_user(self, *args): # Will query database and will return a User() object def create_user(self, *args): # Will create a new user and save to the db. # Will return User() object def extra_validation(self, register_form, *args): # Will query the db and add error messages to register_form if any. # return true if able to create new user def get_user_metadata(self, user): # Return a nice object with metadata from auth provider. Used to pre-fill registration forms