Thanks. I am new to this and trying to figure this out. Could you point me to location where the default who.plugin is configured in TG2?
I am thinking one possible solution is to somehow intercept the Challenge phase of the repoze.who request processing. Is this the right approach? I am assuming the behaviour is as follows: a) The plugins are configured in some who.ini file; b) The order of the declaration of the plugins equates to the order of invocation; c) If a particular plugin cannot handle a request it returns None, so that the request flow proceeds to the next plugin (in the same category if required) If my understanding is correct, then I guess I could add a challenger plugin, that would check a request header and handle it somehow (... i don't know yet), such that the resultant behaviour is for the application to send a 401 (but not a login form redirection). http://docs.repoze.org/who/1.0/narr.html#lifecycle-of-a-request I would be obliged if you can point me to more reading material. Repoze request classifier is one another aspect I should probably learn about. Thanks. On Nov 24, 2:58 am, "Diez B. Roggisch" <[email protected]> wrote: > On Wednesday, November 24, 2010 06:48:08 ozwyzard wrote: > > When a user uses a typical browser to access a page that requires > > authentication, TG2 automatically responds with redirect to the login > > page (along with 'came_from 'parameter in the login url). > > > However, I have a scenario where a state-machine driven program > > accesses the same page, and expects an HTTP 401 response in order to > > retry with authentication credentials. > > > I would like TG2 to redirect to login page for some browsers, but not > > for some others. How would I go about achieving this? I have control > > over the program which expects the 401 response. Should I send some > > special X-header in the HTTP request and handle it by means of (a) > > some magic (or config) in repoze.who, or (b) some other TG2 config, or > > (c) some middleware? > > > I was unable to locate any specific info in the 'Pylons' book to solve > > the above. > > This can be done using repoze.who plugins. Search this list for mentionings of > it, there have been discussions about this before. And yes, you need of course > to have some distinguishing criteria for them to render a different response. > > Diez -- You received this message because you are subscribed to the Google Groups "TurboGears" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/turbogears?hl=en.

