1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/adcb595753b0/ Changeset: adcb595753b0 User: carlfeberhard Date: 2015-02-02 23:57:54+00:00 Summary: Fix to 8e5b9ca: implement _future_expose_api_anonymous_and_sessionless to allow endpoints to be access without user or session (fixes access to api/authenticate) Affected #: 3 files diff -r 147c8b343d4ae09d4ae71d424037e45f06bd8e9e -r adcb595753b02cc9757a8f36a34898d4ea2233e7 lib/galaxy/web/__init__.py --- a/lib/galaxy/web/__init__.py +++ b/lib/galaxy/web/__init__.py @@ -18,6 +18,7 @@ from framework.decorators import _future_expose_api_anonymous from framework.decorators import _future_expose_api_raw from framework.decorators import _future_expose_api_raw_anonymous +from framework.decorators import _future_expose_api_anonymous_and_sessionless from framework.formbuilder import form from framework.formbuilder import FormBuilder diff -r 147c8b343d4ae09d4ae71d424037e45f06bd8e9e -r adcb595753b02cc9757a8f36a34898d4ea2233e7 lib/galaxy/web/framework/decorators.py --- a/lib/galaxy/web/framework/decorators.py +++ b/lib/galaxy/web/framework/decorators.py @@ -196,7 +196,7 @@ # ----------------------------------------------------------------------------- (new) api decorators # TODO: rename as expose_api and make default. -def _future_expose_api( func, to_json=True, user_required=True ): +def _future_expose_api( func, to_json=True, user_required=True, user_or_session_required=True ): """ Expose this function via the API. """ @@ -206,10 +206,11 @@ # TODO: Document this branch, when can this happen, # I don't understand it. return __api_error_response( trans, err_msg=trans.error_message ) + # error if user required and anon # error if anon and no session if ( ( trans.anonymous and user_required ) - or ( trans.anonymous and not trans.galaxy_session ) ): + or ( trans.anonymous and user_or_session_required and not trans.galaxy_session ) ): error_code = error_codes.USER_NO_API_KEY # Use error codes default error message. err_msg = "API authentication required for this request" @@ -325,17 +326,20 @@ return dumps( error_dict ) -# TODO: rename as expose_api and make default. def _future_expose_api_anonymous( func, to_json=True ): """ Expose this function via the API but don't require a set user. """ return _future_expose_api( func, to_json=to_json, user_required=False ) +def _future_expose_api_anonymous_and_sessionless( func, to_json=True ): + """ + Expose this function via the API but don't require a user or a galaxy_session. + """ + return _future_expose_api( func, to_json=to_json, user_required=False, user_or_session_required=False ) def _future_expose_api_raw( func ): return _future_expose_api( func, to_json=False, user_required=True ) - def _future_expose_api_raw_anonymous( func ): return _future_expose_api( func, to_json=False, user_required=False ) diff -r 147c8b343d4ae09d4ae71d424037e45f06bd8e9e -r adcb595753b02cc9757a8f36a34898d4ea2233e7 lib/galaxy/webapps/galaxy/api/authenticate.py --- a/lib/galaxy/webapps/galaxy/api/authenticate.py +++ b/lib/galaxy/webapps/galaxy/api/authenticate.py @@ -14,7 +14,7 @@ from base64 import b64decode from urllib import unquote -from galaxy.web import _future_expose_api_anonymous as expose_api_anonymous +from galaxy.web import _future_expose_api_anonymous_and_sessionless as expose_api_anonymous_and_sessionless from galaxy.managers import api_keys from galaxy import exceptions from galaxy.web.base.controller import BaseAPIController @@ -29,7 +29,7 @@ super( AuthenticationController, self ).__init__( app ) self.api_keys_manager = api_keys.ApiKeyManager( app ) - @expose_api_anonymous + @expose_api_anonymous_and_sessionless def get_api_key( self, trans, **kwd ): """ def get_api_key( self, trans, **kwd ) 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.