Authentication: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
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. |
||
== Auth Plugin Design Pros/Cons == |
|||
Interfacey Design w/o hooks: |
|||
<nowiki>Place holder |
|||
</nowiki> |
|||
Interfacey Design w/ hooks: |
|||
<nowiki>Insert non-formatted text here</nowiki> |
|||
Non-Interfacey Design w/ hooks for every call: |
|||
<nowiki>Insert non-formatted text here</nowiki> |
|||
== __init__.py Base Class == |
== __init__.py Base Class == |
Revision as of 18:22, 2 May 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.
Auth Plugin Design Pros/Cons
Interfacey Design w/o hooks:
Place holder
Interfacey Design w/ hooks:
Insert non-formatted text here
Non-Interfacey Design w/ hooks for every call:
Insert non-formatted text here
__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