commit/galaxy-central: dan: Add an option to biostar integration to never authenticate.
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/41889121607b/ Changeset: 41889121607b User: dan Date: 2014-04-17 21:38:42 Summary: Add an option to biostar integration to never authenticate. Affected #: 2 files diff -r 31eee538eb2161a378425d9190e600b42a0d32e3 -r 41889121607bab478bba3a9b606a12f1a6c690b4 lib/galaxy/config.py --- a/lib/galaxy/config.py +++ b/lib/galaxy/config.py @@ -330,6 +330,7 @@ self.biostar_key_name = kwargs.get( 'biostar_key_name', None ) self.biostar_key = kwargs.get( 'biostar_key', None ) self.biostar_enable_bug_reports = string_as_bool( kwargs.get( 'biostar_enable_bug_reports', True ) ) + self.biostar_never_authenticate = string_as_bool( kwargs.get( 'biostar_never_authenticate', False ) ) self.pretty_datetime_format = expand_pretty_datetime_format( kwargs.get( 'pretty_datetime_format', '$locale (UTC)' ) ) self.master_api_key = kwargs.get( 'master_api_key', None ) if self.master_api_key == "changethis": # default in sample config file diff -r 31eee538eb2161a378425d9190e600b42a0d32e3 -r 41889121607bab478bba3a9b606a12f1a6c690b4 lib/galaxy/util/biostar.py --- a/lib/galaxy/util/biostar.py +++ b/lib/galaxy/util/biostar.py @@ -2,6 +2,7 @@ Support for integration with the Biostar application """ +import logging import hmac import urlparse import re @@ -10,6 +11,8 @@ from galaxy.tools.errors import ErrorReporter from . import smart_str +log = logging.getLogger( __name__ ) + _punct_re = re.compile(r'[\t !"#$%&\'()*\-/<=>?@\[\\\]^_`{|},.]+') DEFAULT_GALAXY_TAG = '' @@ -113,7 +116,10 @@ return galaxy_hostname -def create_cookie( trans, key_name, key, email, age=DEFAULT_BIOSTAR_COOKIE_AGE ): +def create_cookie( trans, key_name, key, email, age=DEFAULT_BIOSTAR_COOKIE_AGE, override_never_authenticate=False ): + if trans.app.config.biostar_never_authenticate and not override_never_authenticate: + log.debug( 'A BioStar link was clicked, but never authenticate has been enabled, so we will not create the login cookie.' ) + return digest = hmac.new( key, email ).hexdigest() value = "%s:%s" % (email, digest) trans.set_cookie( value, name=key_name, path='/', age=age, version='1' ) @@ -125,7 +131,7 @@ def delete_cookie( trans, key_name ): #Set expiration of Cookie to time in past, to cause browser to delete if key_name in trans.request.cookies: - create_cookie( trans, trans.app.config.biostar_key_name, '', '', age=-90 ) + create_cookie( trans, trans.app.config.biostar_key_name, '', '', age=-90, override_never_authenticate=True ) def biostar_logged_in( trans ): if biostar_enabled( trans.app ): Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.
participants (1)
-
commits-noreply@bitbucket.org