mirror of
https://github.com/chanzuckerberg/cellxgene.git
synced 2026-09-15 20:57:56 +08:00
* Add basic authentication in the server A pattern for creating authentication methods is introduced, with three authentication types defined: none - no authentication session - like the current session based auth used for user annotations test - used to test the login/logout process end to end The config endpoint now returns informations about the authentication, like if the user is authenticated and their username. The redirect uri's for login and logout are also returned if the authentication type requires login This is the first a several PRs for authentication. *. Update server tests to avoid hardcoded ports test_api and test_nan_rest now use a common function for starting a test server, than will initially choose a random port.
28 lines
575 B
Python
28 lines
575 B
Python
from server.auth.auth import AuthTypeBase, AuthTypeFactory
|
|
from server.common.errors import ConfigurationError
|
|
|
|
|
|
class AuthTypeNone(AuthTypeBase):
|
|
|
|
def __init__(self):
|
|
super().__init__()
|
|
|
|
def is_valid(self):
|
|
return False
|
|
|
|
def set_params(self, params):
|
|
if params:
|
|
raise ConfigurationError("not expecting authentication parameters")
|
|
|
|
def is_authenticated(self):
|
|
return True
|
|
|
|
def get_userid(self):
|
|
return None
|
|
|
|
def get_username(self):
|
|
return None
|
|
|
|
|
|
AuthTypeFactory.register(None, AuthTypeNone)
|