Skip to content

Commit

Permalink
ISPyB LIMS: add a hook method for ISPyB authentication
Browse files Browse the repository at this point in the history
Add an abstract method ispyb_login(), which is invoked when auth
server is set to 'ispyb'.

This allow to implement ISPyB authentication by overriding this
method in your custom ISPyB lims class.
  • Loading branch information
elmjag committed Jan 28, 2025
1 parent 4b3ad47 commit 6838553
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion mxcubecore/HardwareObjects/ProposalTypeISPyBLims.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def _authenticate(self, user_name, psd):
ok = self.ldap_login(user_name, psd)
elif self.authServerType == "ispyb":
logging.getLogger("HWR").debug("ISPyB login")
ok, _ = self._ispybLogin(user_name, psd)
ok, _ = self.ispyb_login(user_name, psd)
else:
raise Exception("Authentication server type is not defined")

Expand Down
2 changes: 1 addition & 1 deletion mxcubecore/HardwareObjects/UserTypeISPyBLims.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def login(self, loginID, psd, ldap_connection=None) -> LimsSessionManager:
logging.getLogger("HWR").debug("User %s logged in LDAP" % login_name)
elif self.authServerType == "ispyb":
logging.getLogger("HWR").debug("ISPyB login")
ok, msg = self._ispybLogin(login_name, psd)
ok, msg = self.ispyb_login(login_name, psd)
else:
raise Exception("Authentication server type is not defined")

Expand Down
3 changes: 3 additions & 0 deletions mxcubecore/HardwareObjects/abstract/ISPyBAbstractLims.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,9 @@ def ldap_login(self, login_name, psd):

return self.ldapConnection.authenticate(login_name, psd)

def ispyb_login(self, login_name, psd):
raise Exception("Abstract class. Not implemented")

def store_data_collection(self, mx_collection, bl_config=None):
return self._store_data_collection(mx_collection, bl_config)

Expand Down

0 comments on commit 6838553

Please sign in to comment.