Re: Shibboleth login

Tonu Mikk <[email protected]>
Newsgroups gmane.comp.bug-tracking.roundup.user
Message-ID <CABDFm8jz8jH_DrHMfDZpx6KCUDZdY+WdUkWO5nUR9oiji45OWA@mail.gmail.com>
This is getting me closer.  The Shibboleth login works now.  I
authenticated with Shibboleth and that opens the Roundup tracker.

However I get a new error immediately after logging in and when I click on
the links in the menu.  For example when I click on the "User List" menu
item, I get the following message:

127.0.0.1 - - [03/Jan/2019 14:04:22] "GET /user HTTP/1.1" 200 5658
Traceback (most recent call last):
  File "/usr/lib64/python2.7/wsgiref/handlers.py", line 86, in run
    self.finish_response()
  File "/usr/lib64/python2.7/wsgiref/handlers.py", line 127, in
finish_response
    for data in self.result:
TypeError: 'NoneType' object is not iterable
127.0.0.1 - - [03/Jan/2019 14:04:22] "GET /user HTTP/1.1" 500 59
----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 42120)
Traceback (most recent call last):
  File "/usr/lib64/python2.7/SocketServer.py", line 295, in
_handle_request_noblock
    self.process_request(request, client_address)
  File "/usr/lib64/python2.7/SocketServer.py", line 321, in process_request
    self.finish_request(request, client_address)
  File "/usr/lib64/python2.7/SocketServer.py", line 334, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/usr/lib64/python2.7/SocketServer.py", line 649, in __init__
    self.handle()
  File "/usr/lib64/python2.7/wsgiref/simple_server.py", line 124, in handle
    handler.run(self.server.get_app())
  File "/usr/lib64/python2.7/wsgiref/handlers.py", line 92, in run
    self.close()
  File "/usr/lib64/python2.7/wsgiref/simple_server.py", line 33, in close
    self.status.split(' ',1)[0], self.bytes_sent
AttributeError: 'NoneType' object has no attribute 'split'
----------------------------------------

I suspect this has something to do with the strip() function. Any thoughts
on how to fix it?


On Wed, Jan 2, 2019 at 6:55 PM John P. Rouillard <[email protected]> wrote:

> Hi Tonu:
>
> In message
> <CABDFm8gyiT-UfpSPSShUwWz=xahgkvxgUfkKHMsXtJsDfPq-6g@mail.gmail.com> ,
> Tonu Mikk writes:
> >Thanks, I tried adding to the wsgi config file (support.py)
> >
> >import os
> >os.environ['REMOTE_USER'] = os.environ['HTTP_REMOTE_USER']
> >
> >I get the following error:
> >[swadm@drcweb-prd trackers]$ python support.py
> >Traceback (most recent call last):
> >  File "support.py", line 2, in <module>
> >    os.environ['REMOTE_USER'] = os.environ['HTTP_REMOTE_USER'].strip
> >  File "/usr/lib64/python2.7/UserDict.py", line 23, in __getitem__
> >    raise KeyError(key)
> >KeyError: 'HTTP_REMOTE_USER'
> >
> >I wonder if the os.environ is different than the wsgi environment?  The
> >HTTP_REMOTE_USER is definately present in wsgi environment.
>
> Ok. Then lets try hijacking/monkey patching the __call__ routine in
> roundup/cgi/wsgi_handler.py. I think that's the entry point that is
> being used by wsgi's make_server.
>
> See below:
>
> >On Mon, Dec 31, 2018 at 8:22 PM John P. Rouillard <[email protected]>
> wrote:
> >> In message
> >> <CABDFm8g24B=2vifajtnWqyvXjCv9oZ-+DpJZxfZZmrvR42gySg@mail.gmail.com>,
> >> Tonu Mikk writes:
> [...]
> >> >How could I change the WSGI directions provided in the roundup
> >> >documentation to incorporate
> >> >
> >> >"environ['REMOTE_USER'] = environ['HTTP_REMOTE_USER'].strip()" ?
> [...]
> >> This is a shot in the dark but, does this work?
> >>
> >> ==
> >> import os
> >> os.environ['REMOTE_USER'] = os.environ['HTTP_REMOTE_USER']
> >>
> >> from wsgiref.simple_server import make_server
> >>
> >> # obtain the WSGI request dispatcher
> >> from roundup.cgi.wsgi_handler import RequestDispatcher
> >> tracker_home = 'demo'
> >> app = RequestDispatcher(tracker_home)
> >>
> >> httpd = make_server('', 8917, app)
> >> httpd.serve_forever()
>
> Try this modification:
>
> ==
> from roundup.cgi.wsgi_handler import RequestDispatcher
>
> class MyDispatcher(RequestDispatcher):
>     def __call__(self, environ, start_response):
>         environ['REMOTE_USER'] = environ['HTTP_REMOTE_USER'].strip()
>         RequestDispatcher.__call__(self,environ,start_response)
>
> from wsgiref.simple_server import make_server
>
> # use our request dispatcher
> tracker_home = 'demo'
> app = MyDispatcher(tracker_home)
>
> httpd = make_server('', 8917, app)
> httpd.serve_forever()
> ==
>
>
> What I am doing is creating a new class MyDispatcher (inheriting from
> RequestDispatcher) creating a replacement __call__ routine. Then I use
> make_server call MyDispatcher instead of RequestDispatcher. This
> should result in MyDispatcher.__call__ being called by make_server.
>
> MyDispatcher.__call__ allows you to change the wsgi environment
> dictionary. Then it calls roundup's RequestDispatcher.__call__ just as
> though you had assigned the output of RequestDispatcher(tracker_home)
> to app.
>
> I think this is safe as the environ should be unique and unshared with
> any other call to the roundup back end.
>
> Anybody with better python knowledge feel free to chime in here, I am
> kind of grasping at straws here.
>
> --
>                                 -- rouilj
> John Rouillard
> ===========================================================================
> My employers don't acknowledge my existence much less my opinions.
>


-- 
Tonu Mikk
Adaptive Technologist | Disability Resource Center |
diversity.umn.edu/disability
University of Minnesota | umn.edu
[email protected] | 612-625-3307

_______________________________________________
Roundup-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/roundup-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.