This is the wrong way to do this. You should be adding a feature to XBlock (as we discussed w/ @nedbat and @auraz), so that we can mark particular handlers (in the XModule/XBlock code) as using custom authentication. Then edx-platform would conditionalize on that (either the way you've done it here, or by having 2 separate urls, one of which is authenticated and one of which isn't). In the 2-urls case, the view behind the un-authenticated url would check the selected xblock handler to make sure that it is, in fact, a handler which is supposed to be unauthenticated.