code: def AuthenticatedOrRedirect(invocation):
      
      class AuthenticatedOrRedirect(GiottoInputMiddleware):
          def http(self, request):
              if request.user:
                  return request
              return Redirection(invocation)
  
          def cmd(self, request):
              if request.user:
                  return request
              return Redirection(invocation)
  
      return AuthenticatedOrRedirect
docs: Middleware class factory that redirects if the user is not logged in.
      Otherwise, nothing is effected.