Re: [Repoze-dev] tg.repoze.who and ProxyPass

2008-05-12 Thread Chris McDonough
This StackedObjectProxy stuff is not necessary, I think, if you:

- put repoze.who in all the pipelines referred to by the urlmap
   middleware configuration.  Make sure it's "to the right of"
   the composite urlmap middleware (closer to the final WSGI
   application than urlmap is).

- change the form plugin's identify method to take into account
   environ['SCRIPT_NAME'] and/or environ['PATH_INFO'] and redirect to a
   different came_from in that method based on some composition those
   values.

- C

percious wrote:
> Right, so I have been tried that, and it looks like repoze is running
> in a different thread.  IE I get :No object (name: repoze.who
> RedirectFormPlugin) has been registered for this thread.
> 
> Here is my diff:
> 
> --- plugins/form.py (revision 1032)
> +++ plugins/form.py (working copy)
> @@ -11,6 +11,8 @@
>  from paste.request import parse_formvars
>  from paste.request import construct_url
> 
> +from paste.registry import StackedObjectProxy, Registry
> +
>  from zope.interface import implements
> 
>  from repoze.who.interfaces import IChallenger
> @@ -119,10 +121,17 @@
> 
>  return auth_form
> 
> +class RequestLocal(object):
> +def __init__(self, environ):
> +self.environ = environ
> +
>  class RedirectingFormPlugin(FormPluginBase):
> 
>  implements(IChallenger, IIdentifier)
> 
> +request_local = StackedObjectProxy(name="repoze.who
> RedirectFormPlugin")
> +request_local_class = request_local
> +
>  def __init__(self, login_form_url, login_handler_path,
> logout_handler_path,
>   rememberer_name):
>  self.login_form_url = login_form_url
> @@ -176,6 +185,16 @@
>  query_elements['came_from'] = came_from
>  url_parts[4] = urllib.urlencode(query_elements, doseq=True)
>  login_form_url = urlparse.urlunparse(url_parts)
> +
> +registry = environ['paste.registry']
> +registry.register(self.request_local,
> self.request_local_class(environ))
> +
> +script_name = self.request_local.environ['SCRIPT_NAME']
> +
> +
> +login_form_url = script_name + '/' + login_form_url
> +print 'repoze', login_form_url
> +
>  headers = [ ('Location', login_form_url) ]
>  headers = headers + forget_headers
>  return HTTPFound(headers=headers)
> 
> 
> On May 12, 11:43 am, Chris McDonough <[EMAIL PROTECTED]> wrote:
>> percious wrote:
>>> Ok, so I started digging, because I have to get this working for work
>>> now
>>> Looking at the Tosca 
>>> source:http://svn.turbogears.org/projects/ToscaWidgets/trunk/tw/mods/base.py
>>> The "url" function:
>>> def url(self, url):
>>> """
>>> Returns the absolute path for the given url.
>>> """
>>> prefix = self.request_local.environ['toscawidgets.prefix']
>>> script_name = self.request_local.environ['SCRIPT_NAME']
>>> return ''.join([script_name, prefix, url])
>>> makes a call to a StackedObjectProxy object and pulls out the
>>> 'mytg2app' from 'SCRIPT_NAME'.  Is it possible to create the same
>>> StackedObjectProxy in the repoze software so that the redirect does a
>>> similar thing?
>> I'm not even sure what a StackedObjectProxy is.  I'm pretty sure repoze.who
>> doesn't want to create one, at least in the general case.
>>
>> I *think* this is really just a matter of cooperating with the paste.urlmap
>> middleware.  You probably want to pay attention to what 
>> paste.urlmap.URLMapper
>> does in its __call__ method:
>>
>>  def __call__(self, environ, start_response):
>>  host = environ.get('HTTP_HOST', environ.get('SERVER_NAME')).lower()
>>  if ':' in host:
>>  host, port = host.split(':', 1)
>>  else:
>>  if environ['wsgi.url_scheme'] == 'http':
>>  port = '80'
>>  else:
>>  port = '443'
>>  path_info = environ.get('PATH_INFO')
>>  path_info = self.normalize_url(path_info, False)[1]
>>  for (domain, app_url), app in self.applications:
>>  if domain and domain != host and domain != host+':'+port:
>>  continue
>>  if (path_info == app_url
>>  or path_info.startswith(app_url + '/')):
>>  environ['SCRIPT_NAME'] += app_url
>>  environ['PATH_INFO'] = path_info[len(app_url):]
>>  return app(environ, start_response)
>>  environ['paste.urlmap_object'] = self
>>  return self.not_found_application(environ, start_response)
>>
>> E.g. it munges environ['SCRIPT_NAME'] and environ['PATH_INFO'].  Joining some
>> combination of those two plus the login_form_url should get you what you 
>> need, I
>> think, right?
>>
>> - C
>> ___
>> Repoze-dev mailing list
>> [EMAIL PROTECTED]://lists.repoze.org/listinfo/repoze-dev
> ___
> Repoze-dev mailing list
> Repoze-dev@lists.

Re: [Repoze-dev] tg.repoze.who and ProxyPass

2008-05-12 Thread percious
Right, so I have been tried that, and it looks like repoze is running
in a different thread.  IE I get :No object (name: repoze.who
RedirectFormPlugin) has been registered for this thread.

Here is my diff:

--- plugins/form.py (revision 1032)
+++ plugins/form.py (working copy)
@@ -11,6 +11,8 @@
 from paste.request import parse_formvars
 from paste.request import construct_url

+from paste.registry import StackedObjectProxy, Registry
+
 from zope.interface import implements

 from repoze.who.interfaces import IChallenger
@@ -119,10 +121,17 @@

 return auth_form

+class RequestLocal(object):
+def __init__(self, environ):
+self.environ = environ
+
 class RedirectingFormPlugin(FormPluginBase):

 implements(IChallenger, IIdentifier)

+request_local = StackedObjectProxy(name="repoze.who
RedirectFormPlugin")
+request_local_class = request_local
+
 def __init__(self, login_form_url, login_handler_path,
logout_handler_path,
  rememberer_name):
 self.login_form_url = login_form_url
@@ -176,6 +185,16 @@
 query_elements['came_from'] = came_from
 url_parts[4] = urllib.urlencode(query_elements, doseq=True)
 login_form_url = urlparse.urlunparse(url_parts)
+
+registry = environ['paste.registry']
+registry.register(self.request_local,
self.request_local_class(environ))
+
+script_name = self.request_local.environ['SCRIPT_NAME']
+
+
+login_form_url = script_name + '/' + login_form_url
+print 'repoze', login_form_url
+
 headers = [ ('Location', login_form_url) ]
 headers = headers + forget_headers
 return HTTPFound(headers=headers)


On May 12, 11:43 am, Chris McDonough <[EMAIL PROTECTED]> wrote:
> percious wrote:
> > Ok, so I started digging, because I have to get this working for work
> > now
> > Looking at the Tosca 
> > source:http://svn.turbogears.org/projects/ToscaWidgets/trunk/tw/mods/base.py
>
> > The "url" function:
>
> > def url(self, url):
> > """
> > Returns the absolute path for the given url.
> > """
> > prefix = self.request_local.environ['toscawidgets.prefix']
> > script_name = self.request_local.environ['SCRIPT_NAME']
> > return ''.join([script_name, prefix, url])
>
> > makes a call to a StackedObjectProxy object and pulls out the
> > 'mytg2app' from 'SCRIPT_NAME'.  Is it possible to create the same
> > StackedObjectProxy in the repoze software so that the redirect does a
> > similar thing?
>
> I'm not even sure what a StackedObjectProxy is.  I'm pretty sure repoze.who
> doesn't want to create one, at least in the general case.
>
> I *think* this is really just a matter of cooperating with the paste.urlmap
> middleware.  You probably want to pay attention to what paste.urlmap.URLMapper
> does in its __call__ method:
>
>  def __call__(self, environ, start_response):
>  host = environ.get('HTTP_HOST', environ.get('SERVER_NAME')).lower()
>  if ':' in host:
>  host, port = host.split(':', 1)
>  else:
>  if environ['wsgi.url_scheme'] == 'http':
>  port = '80'
>  else:
>  port = '443'
>  path_info = environ.get('PATH_INFO')
>  path_info = self.normalize_url(path_info, False)[1]
>  for (domain, app_url), app in self.applications:
>  if domain and domain != host and domain != host+':'+port:
>  continue
>  if (path_info == app_url
>  or path_info.startswith(app_url + '/')):
>  environ['SCRIPT_NAME'] += app_url
>  environ['PATH_INFO'] = path_info[len(app_url):]
>  return app(environ, start_response)
>  environ['paste.urlmap_object'] = self
>  return self.not_found_application(environ, start_response)
>
> E.g. it munges environ['SCRIPT_NAME'] and environ['PATH_INFO'].  Joining some
> combination of those two plus the login_form_url should get you what you 
> need, I
> think, right?
>
> - C
> ___
> Repoze-dev mailing list
> [EMAIL PROTECTED]://lists.repoze.org/listinfo/repoze-dev
___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev


Re: [Repoze-dev] tg.repoze.who and ProxyPass

2008-05-12 Thread Chris McDonough
percious wrote:
> Ok, so I started digging, because I have to get this working for work
> now
> Looking at the Tosca source: 
> http://svn.turbogears.org/projects/ToscaWidgets/trunk/tw/mods/base.py
> 
> The "url" function:
> 
> def url(self, url):
> """
> Returns the absolute path for the given url.
> """
> prefix = self.request_local.environ['toscawidgets.prefix']
> script_name = self.request_local.environ['SCRIPT_NAME']
> return ''.join([script_name, prefix, url])
> 
> 
> makes a call to a StackedObjectProxy object and pulls out the
> 'mytg2app' from 'SCRIPT_NAME'.  Is it possible to create the same
> StackedObjectProxy in the repoze software so that the redirect does a
> similar thing?

I'm not even sure what a StackedObjectProxy is.  I'm pretty sure repoze.who 
doesn't want to create one, at least in the general case.

I *think* this is really just a matter of cooperating with the paste.urlmap 
middleware.  You probably want to pay attention to what paste.urlmap.URLMapper 
does in its __call__ method:

 def __call__(self, environ, start_response):
 host = environ.get('HTTP_HOST', environ.get('SERVER_NAME')).lower()
 if ':' in host:
 host, port = host.split(':', 1)
 else:
 if environ['wsgi.url_scheme'] == 'http':
 port = '80'
 else:
 port = '443'
 path_info = environ.get('PATH_INFO')
 path_info = self.normalize_url(path_info, False)[1]
 for (domain, app_url), app in self.applications:
 if domain and domain != host and domain != host+':'+port:
 continue
 if (path_info == app_url
 or path_info.startswith(app_url + '/')):
 environ['SCRIPT_NAME'] += app_url
 environ['PATH_INFO'] = path_info[len(app_url):]
 return app(environ, start_response)
 environ['paste.urlmap_object'] = self
 return self.not_found_application(environ, start_response)

E.g. it munges environ['SCRIPT_NAME'] and environ['PATH_INFO'].  Joining some 
combination of those two plus the login_form_url should get you what you need, 
I 
think, right?

- C
___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev


Re: [Repoze-dev] tg.repoze.who and ProxyPass

2008-05-12 Thread percious
Ok, so I started digging, because I have to get this working for work
now
Looking at the Tosca source: 
http://svn.turbogears.org/projects/ToscaWidgets/trunk/tw/mods/base.py

The "url" function:

def url(self, url):
"""
Returns the absolute path for the given url.
"""
prefix = self.request_local.environ['toscawidgets.prefix']
script_name = self.request_local.environ['SCRIPT_NAME']
return ''.join([script_name, prefix, url])


makes a call to a StackedObjectProxy object and pulls out the
'mytg2app' from 'SCRIPT_NAME'.  Is it possible to create the same
StackedObjectProxy in the repoze software so that the redirect does a
similar thing?

cheers.
-chris

On May 11, 6:41 pm, Chris McDonough <[EMAIL PROTECTED]> wrote:
> I suspect taking a look at the Paste urlmap composite implementation would 
> give
> you a clue as to what needs to change in the plugin (e.g. figure out how/if it
> signals that a particular prefix is in use).  Even if it doesn't immediately 
> go
> into the repoze.who mainline, you should be able to make a new plugin through
> judicious cut and paste and hack on it.
>
> In particular, its' "challenge" method looks like this:
>
>  # IChallenger
>  def challenge(self, environ, status, app_headers, forget_headers):
>  url_parts = list(urlparse.urlparse(self.login_form_url))
>  query = url_parts[4]
>  query_elements = cgi.parse_qs(query)
>  came_from = environ.get('came_from', construct_url(environ))
>  query_elements['came_from'] = came_from
>  url_parts[4] = urllib.urlencode(query_elements, doseq=True)
>  login_form_url = urlparse.urlunparse(url_parts)
>  headers = [ ('Location', login_form_url) ]
>  headers = headers + forget_headers
>  return HTTPFound(headers=headers)
>
> The login_form_url should be composed dynamically based on stuff in the
> environment set by the urlmap composite plus whatever is set in the
> configuration of the plugin.
>
> - C
>
>
>
> percious wrote:
> > Since the tg.repoze.who creates a paster app, I don't really see why
> > the page could not know where in the url path it should direct
> > people.  I am ccing Alberto in the hopes that he can help us clear
> > this stuff up.
>
> > cheers.
> > -chris
>
> > On May 9, 5:32 pm, Chris McDonough <[EMAIL PROTECTED]> wrote:
> >> It's statically configured now.  The plugin itself would need to change to
> >> support redirecting to a dynamic URL.
>
> >> If you weren't up for changing the plugin, you could *try* using the
> >> "non-redirecting" form plugin (replace the call to "form = 
> >> RedirectingFormPlugin
> >> ..." with what's below).  This plugin renders a login form directly without
> >> needing to redirect:
>
> >> FORMBODY = """
> >> 
> >> 
> >>Log In
> >> 
> >> 
> >>
> >>   Log In
> >>
> >>
> >>
> >>  
> >>  
> >>User Name
> >>
> >>  
> >>  
> >>Password
> >>   
> >>  
> >>  
> >>
> >>
> >>  
> >>  
> >>
> >>
> >>
> >> 
> >> 
> >> """
> >> form = FormPlugin(login_qs='__do_login', rememberer_name='cookie', 
> >> FORMBODY)
>
> >> - C
>
> >> percious wrote:
> >>> Yeah, I realized that.  I was just wondering, how can I get it to
> >>> automatically figure out the paste prefix?  This is something that
> >>> goes off without a hitch in toscawidgets.
> >>> cheers.
> >>> -chris
> >>> On May 9, 5:15 pm, Chris McDonough <[EMAIL PROTECTED]> wrote:
>  I think what you might be seeing if you're using the configuration of 
>  repoze.who
>  implied 
>  byhttp://svn.turbogears.org/projects/tgrepozewho/trunk/tgrepozewho/midd...
>  is that the thing that shows the challenge (the form plugin) is 
>  configured
>  statically, e.g. (from that file):
>   form = RedirectingFormPlugin('/login', '/login_handler', 
>  '/logout_handler',
>    rememberer_name='cookie')
>  The first argument there is the "login_form_url".  That's the URL that
>  repoze.who will redirect to when a login is required.  You probably need 
>  to
>  change this to support your environment.
>  - C
>  percious wrote:
> > So, I almost have my project up and running on the production server.
> > The thing is, I have a large server with many applications, and they
> > are all mounted at the highest level of the global tree: ie
> >http://my.ip.address.com/plone
> >http://my.ip.address.com/tg2app
> > All the applications are routed with apache using:
> > 
> >   DocumentRoot /my/tg2app/public
> >   ProxyPass /tg2app/http://127.0.0.1:8080/
> >   ProxyPassReverse /tg2app/http://127.0.0.1:8080/
> >   ...
> > 
> > ok, so this all works fine with wsgi, all I have to do is add
> > something like:
> > [filter:proxy-prefix]
> > use = egg:PasteDeploy#p

Re: [Repoze-dev] tg.repoze.who and ProxyPass

2008-05-11 Thread Chris McDonough
I suspect taking a look at the Paste urlmap composite implementation would give 
you a clue as to what needs to change in the plugin (e.g. figure out how/if it 
signals that a particular prefix is in use).  Even if it doesn't immediately go 
into the repoze.who mainline, you should be able to make a new plugin through 
judicious cut and paste and hack on it.

In particular, its' "challenge" method looks like this:

 # IChallenger
 def challenge(self, environ, status, app_headers, forget_headers):
 url_parts = list(urlparse.urlparse(self.login_form_url))
 query = url_parts[4]
 query_elements = cgi.parse_qs(query)
 came_from = environ.get('came_from', construct_url(environ))
 query_elements['came_from'] = came_from
 url_parts[4] = urllib.urlencode(query_elements, doseq=True)
 login_form_url = urlparse.urlunparse(url_parts)
 headers = [ ('Location', login_form_url) ]
 headers = headers + forget_headers
 return HTTPFound(headers=headers)

The login_form_url should be composed dynamically based on stuff in the 
environment set by the urlmap composite plus whatever is set in the 
configuration of the plugin.

- C

percious wrote:
> Since the tg.repoze.who creates a paster app, I don't really see why
> the page could not know where in the url path it should direct
> people.  I am ccing Alberto in the hopes that he can help us clear
> this stuff up.
> 
> cheers.
> -chris
> 
> On May 9, 5:32 pm, Chris McDonough <[EMAIL PROTECTED]> wrote:
>> It's statically configured now.  The plugin itself would need to change to
>> support redirecting to a dynamic URL.
>>
>> If you weren't up for changing the plugin, you could *try* using the
>> "non-redirecting" form plugin (replace the call to "form = 
>> RedirectingFormPlugin
>> ..." with what's below).  This plugin renders a login form directly without
>> needing to redirect:
>>
>> FORMBODY = """
>> 
>> 
>>Log In
>> 
>> 
>>
>>   Log In
>>
>>
>>
>>  
>>  
>>User Name
>>
>>  
>>  
>>Password
>>   
>>  
>>  
>>
>>
>>  
>>  
>>
>>
>>
>> 
>> 
>> """
>> form = FormPlugin(login_qs='__do_login', rememberer_name='cookie', FORMBODY)
>>
>> - C
>>
>>
>>
>> percious wrote:
>>> Yeah, I realized that.  I was just wondering, how can I get it to
>>> automatically figure out the paste prefix?  This is something that
>>> goes off without a hitch in toscawidgets.
>>> cheers.
>>> -chris
>>> On May 9, 5:15 pm, Chris McDonough <[EMAIL PROTECTED]> wrote:
 I think what you might be seeing if you're using the configuration of 
 repoze.who
 implied 
 byhttp://svn.turbogears.org/projects/tgrepozewho/trunk/tgrepozewho/midd...
 is that the thing that shows the challenge (the form plugin) is configured
 statically, e.g. (from that file):
  form = RedirectingFormPlugin('/login', '/login_handler', 
 '/logout_handler',
   rememberer_name='cookie')
 The first argument there is the "login_form_url".  That's the URL that
 repoze.who will redirect to when a login is required.  You probably need to
 change this to support your environment.
 - C
 percious wrote:
> So, I almost have my project up and running on the production server.
> The thing is, I have a large server with many applications, and they
> are all mounted at the highest level of the global tree: ie
> http://my.ip.address.com/plone
> http://my.ip.address.com/tg2app
> All the applications are routed with apache using:
> 
>   DocumentRoot /my/tg2app/public
>   ProxyPass /tg2app/http://127.0.0.1:8080/
>   ProxyPassReverse /tg2app/http://127.0.0.1:8080/
>   ...
> 
> ok, so this all works fine with wsgi, all I have to do is add
> something like:
> [filter:proxy-prefix]
> use = egg:PasteDeploy#prefix
> prefix = /tg2app
> [app:main]
> filter-with = proxy-prefix
> to my ini file and it works.
> Until I go to login.
> For whatever reason, the login script keeps sending me back to the
> root...  Is there a fix for this?
> Also, once I have that working, it appears that I will have a
> requirement to authenticate using Apache's authentication (ick) is
> there a way to send the Apache Authentication over to repoze.who?
> cheers.
> -chris
> ___
> Repoze-dev mailing list
> [EMAIL PROTECTED]
> http://lists.repoze.org/listinfo/repoze-dev
 ___
 Repoze-dev mailing list
 [EMAIL PROTECTED]://lists.repoze.org/listinfo/repoze-dev
>>> ___
>>> Repoze-dev mailing list
>>> [EMAIL PROTECTED]
>>> http://lists.repoze.org/listinfo/repoze-dev
>> ___
>> Repoz

Re: [Repoze-dev] tg.repoze.who and ProxyPass

2008-05-11 Thread percious
Since the tg.repoze.who creates a paster app, I don't really see why
the page could not know where in the url path it should direct
people.  I am ccing Alberto in the hopes that he can help us clear
this stuff up.

cheers.
-chris

On May 9, 5:32 pm, Chris McDonough <[EMAIL PROTECTED]> wrote:
> It's statically configured now.  The plugin itself would need to change to
> support redirecting to a dynamic URL.
>
> If you weren't up for changing the plugin, you could *try* using the
> "non-redirecting" form plugin (replace the call to "form = 
> RedirectingFormPlugin
> ..." with what's below).  This plugin renders a login form directly without
> needing to redirect:
>
> FORMBODY = """
> 
> 
>    Log In
> 
> 
>    
>       Log In
>    
>    
>    
>      
>      
>        User Name
>        
>      
>      
>        Password
>       
>      
>      
>        
>        
>      
>      
>    
>    
>    
> 
> 
> """
> form = FormPlugin(login_qs='__do_login', rememberer_name='cookie', FORMBODY)
>
> - C
>
>
>
> percious wrote:
> > Yeah, I realized that.  I was just wondering, how can I get it to
> > automatically figure out the paste prefix?  This is something that
> > goes off without a hitch in toscawidgets.
>
> > cheers.
> > -chris
>
> > On May 9, 5:15 pm, Chris McDonough <[EMAIL PROTECTED]> wrote:
> >> I think what you might be seeing if you're using the configuration of 
> >> repoze.who
> >> implied 
> >> byhttp://svn.turbogears.org/projects/tgrepozewho/trunk/tgrepozewho/midd...
> >> is that the thing that shows the challenge (the form plugin) is configured
> >> statically, e.g. (from that file):
>
> >>      form = RedirectingFormPlugin('/login', '/login_handler', 
> >> '/logout_handler',
> >>                                   rememberer_name='cookie')
>
> >> The first argument there is the "login_form_url".  That's the URL that
> >> repoze.who will redirect to when a login is required.  You probably need to
> >> change this to support your environment.
>
> >> - C
>
> >> percious wrote:
> >>> So, I almost have my project up and running on the production server.
> >>> The thing is, I have a large server with many applications, and they
> >>> are all mounted at the highest level of the global tree: ie
> >>>http://my.ip.address.com/plone
> >>>http://my.ip.address.com/tg2app
> >>> All the applications are routed with apache using:
> >>> 
> >>>           DocumentRoot /my/tg2app/public
> >>>           ProxyPass /tg2app/http://127.0.0.1:8080/
> >>>           ProxyPassReverse /tg2app/http://127.0.0.1:8080/
> >>>       ...
> >>> 
> >>> ok, so this all works fine with wsgi, all I have to do is add
> >>> something like:
> >>> [filter:proxy-prefix]
> >>> use = egg:PasteDeploy#prefix
> >>> prefix = /tg2app
> >>> [app:main]
> >>> filter-with = proxy-prefix
> >>> to my ini file and it works.
> >>> Until I go to login.
> >>> For whatever reason, the login script keeps sending me back to the
> >>> root...  Is there a fix for this?
> >>> Also, once I have that working, it appears that I will have a
> >>> requirement to authenticate using Apache's authentication (ick) is
> >>> there a way to send the Apache Authentication over to repoze.who?
> >>> cheers.
> >>> -chris
> >>> ___
> >>> Repoze-dev mailing list
> >>> [EMAIL PROTECTED]
> >>>http://lists.repoze.org/listinfo/repoze-dev
> >> ___
> >> Repoze-dev mailing list
> >> [EMAIL PROTECTED]://lists.repoze.org/listinfo/repoze-dev
> > ___
> > Repoze-dev mailing list
> > [EMAIL PROTECTED]
> >http://lists.repoze.org/listinfo/repoze-dev
>
> ___
> Repoze-dev mailing list
> [EMAIL PROTECTED]://lists.repoze.org/listinfo/repoze-dev
___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev


Re: [Repoze-dev] tg.repoze.who and ProxyPass

2008-05-09 Thread Chris McDonough
It's statically configured now.  The plugin itself would need to change to 
support redirecting to a dynamic URL.

If you weren't up for changing the plugin, you could *try* using the 
"non-redirecting" form plugin (replace the call to "form = 
RedirectingFormPlugin 
..." with what's below).  This plugin renders a login form directly without 
needing to redirect:

FORMBODY = """


   Log In


   
  Log In
   
   
   
 
 
   User Name
   
 
 
   Password
  
 
 
   
   
 
 
   
   
   


"""
form = FormPlugin(login_qs='__do_login', rememberer_name='cookie', FORMBODY)

- C


percious wrote:
> Yeah, I realized that.  I was just wondering, how can I get it to
> automatically figure out the paste prefix?  This is something that
> goes off without a hitch in toscawidgets.
> 
> cheers.
> -chris
> 
> On May 9, 5:15 pm, Chris McDonough <[EMAIL PROTECTED]> wrote:
>> I think what you might be seeing if you're using the configuration of 
>> repoze.who
>> implied 
>> byhttp://svn.turbogears.org/projects/tgrepozewho/trunk/tgrepozewho/midd...
>> is that the thing that shows the challenge (the form plugin) is configured
>> statically, e.g. (from that file):
>>
>>  form = RedirectingFormPlugin('/login', '/login_handler', 
>> '/logout_handler',
>>   rememberer_name='cookie')
>>
>> The first argument there is the "login_form_url".  That's the URL that
>> repoze.who will redirect to when a login is required.  You probably need to
>> change this to support your environment.
>>
>> - C
>>
>>
>>
>> percious wrote:
>>> So, I almost have my project up and running on the production server.
>>> The thing is, I have a large server with many applications, and they
>>> are all mounted at the highest level of the global tree: ie
>>> http://my.ip.address.com/plone
>>> http://my.ip.address.com/tg2app
>>> All the applications are routed with apache using:
>>> 
>>>   DocumentRoot /my/tg2app/public
>>>   ProxyPass /tg2app/http://127.0.0.1:8080/
>>>   ProxyPassReverse /tg2app/http://127.0.0.1:8080/
>>>   ...
>>> 
>>> ok, so this all works fine with wsgi, all I have to do is add
>>> something like:
>>> [filter:proxy-prefix]
>>> use = egg:PasteDeploy#prefix
>>> prefix = /tg2app
>>> [app:main]
>>> filter-with = proxy-prefix
>>> to my ini file and it works.
>>> Until I go to login.
>>> For whatever reason, the login script keeps sending me back to the
>>> root...  Is there a fix for this?
>>> Also, once I have that working, it appears that I will have a
>>> requirement to authenticate using Apache's authentication (ick) is
>>> there a way to send the Apache Authentication over to repoze.who?
>>> cheers.
>>> -chris
>>> ___
>>> Repoze-dev mailing list
>>> [EMAIL PROTECTED]
>>> http://lists.repoze.org/listinfo/repoze-dev
>> ___
>> Repoze-dev mailing list
>> [EMAIL PROTECTED]://lists.repoze.org/listinfo/repoze-dev
> ___
> Repoze-dev mailing list
> Repoze-dev@lists.repoze.org
> http://lists.repoze.org/listinfo/repoze-dev
> 

___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev


Re: [Repoze-dev] tg.repoze.who and ProxyPass

2008-05-09 Thread percious
Yeah, I realized that.  I was just wondering, how can I get it to
automatically figure out the paste prefix?  This is something that
goes off without a hitch in toscawidgets.

cheers.
-chris

On May 9, 5:15 pm, Chris McDonough <[EMAIL PROTECTED]> wrote:
> I think what you might be seeing if you're using the configuration of 
> repoze.who
> implied 
> byhttp://svn.turbogears.org/projects/tgrepozewho/trunk/tgrepozewho/midd...
> is that the thing that shows the challenge (the form plugin) is configured
> statically, e.g. (from that file):
>
>  form = RedirectingFormPlugin('/login', '/login_handler', 
> '/logout_handler',
>   rememberer_name='cookie')
>
> The first argument there is the "login_form_url".  That's the URL that
> repoze.who will redirect to when a login is required.  You probably need to
> change this to support your environment.
>
> - C
>
>
>
> percious wrote:
> > So, I almost have my project up and running on the production server.
> > The thing is, I have a large server with many applications, and they
> > are all mounted at the highest level of the global tree: ie
>
> >http://my.ip.address.com/plone
> >http://my.ip.address.com/tg2app
>
> > All the applications are routed with apache using:
> > 
> >   DocumentRoot /my/tg2app/public
>
> >   ProxyPass /tg2app/http://127.0.0.1:8080/
> >   ProxyPassReverse /tg2app/http://127.0.0.1:8080/
> >   ...
> > 
>
> > ok, so this all works fine with wsgi, all I have to do is add
> > something like:
>
> > [filter:proxy-prefix]
> > use = egg:PasteDeploy#prefix
> > prefix = /tg2app
>
> > [app:main]
> > filter-with = proxy-prefix
>
> > to my ini file and it works.
>
> > Until I go to login.
>
> > For whatever reason, the login script keeps sending me back to the
> > root...  Is there a fix for this?
>
> > Also, once I have that working, it appears that I will have a
> > requirement to authenticate using Apache's authentication (ick) is
> > there a way to send the Apache Authentication over to repoze.who?
>
> > cheers.
> > -chris
> > ___
> > Repoze-dev mailing list
> > [EMAIL PROTECTED]
> >http://lists.repoze.org/listinfo/repoze-dev
>
> ___
> Repoze-dev mailing list
> [EMAIL PROTECTED]://lists.repoze.org/listinfo/repoze-dev
___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev


Re: [Repoze-dev] tg.repoze.who and ProxyPass

2008-05-09 Thread Chris McDonough
I think what you might be seeing if you're using the configuration of 
repoze.who 
implied by 
http://svn.turbogears.org/projects/tgrepozewho/trunk/tgrepozewho/middleware.py 
is that the thing that shows the challenge (the form plugin) is configured 
statically, e.g. (from that file):

 form = RedirectingFormPlugin('/login', '/login_handler', '/logout_handler',
  rememberer_name='cookie')

The first argument there is the "login_form_url".  That's the URL that 
repoze.who will redirect to when a login is required.  You probably need to 
change this to support your environment.

- C

percious wrote:
> So, I almost have my project up and running on the production server.
> The thing is, I have a large server with many applications, and they
> are all mounted at the highest level of the global tree: ie
> 
> http://my.ip.address.com/plone
> http://my.ip.address.com/tg2app
> 
> All the applications are routed with apache using:
> 
>   DocumentRoot /my/tg2app/public
> 
>   ProxyPass /tg2app/ http://127.0.0.1:8080/
>   ProxyPassReverse /tg2app/ http://127.0.0.1:8080/
>   ...
> 
> 
> ok, so this all works fine with wsgi, all I have to do is add
> something like:
> 
> [filter:proxy-prefix]
> use = egg:PasteDeploy#prefix
> prefix = /tg2app
> 
> [app:main]
> filter-with = proxy-prefix
> 
> to my ini file and it works.
> 
> Until I go to login.
> 
> For whatever reason, the login script keeps sending me back to the
> root...  Is there a fix for this?
> 
> 
> Also, once I have that working, it appears that I will have a
> requirement to authenticate using Apache's authentication (ick) is
> there a way to send the Apache Authentication over to repoze.who?
> 
> cheers.
> -chris
> ___
> Repoze-dev mailing list
> Repoze-dev@lists.repoze.org
> http://lists.repoze.org/listinfo/repoze-dev
> 

___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev