Changeset 169
- Timestamp:
- 11/09/08 20:42:42
- Files:
-
- AuthKit/trunk/AuthKit.egg-info/PKG-INFO (modified) (1 diff)
- AuthKit/trunk/CHANGELOG.txt (modified) (1 diff)
- AuthKit/trunk/authkit/authenticate/form.py (modified) (7 diffs)
- AuthKit/trunk/examples/docs/form.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
AuthKit/trunk/AuthKit.egg-info/PKG-INFO
r166 r169 53 53 0.4.3 54 54 55 * Added headers to the form handling for IE. Fixes #54 55 * Added a new algorithm based on ideas from #61 to guess the correct action 56 for the form produced by the form middleware but also added support for 57 an authkit.form.action option which allows you to manually override 58 AuthKit's guess. (The OpenID middleware calls this baseurl) 59 * Added user_set_password() methods to users API. Fixes #64. 60 * Removed arabic letters from the form handler. Fixes #40. 61 * Added headers to the form handling for IE. Fixes #54. 56 62 * Adding SQLAlchemy 0.5 support, uses session.add() instead of session.save() 57 63 * The multi handler now handles WSGI applications implemented as iterators, AuthKit/trunk/CHANGELOG.txt
r168 r169 4 4 0.4.3 5 5 6 * Added a new algorithm based on ideas from #61 to guess the correct action 7 for the form produced by the form middleware but also added support for 8 an authkit.form.action option which allows you to manually override 9 AuthKit's guess. (The OpenID middleware calls this baseurl) 6 10 * Added user_set_password() methods to users API. Fixes #64. 7 11 * Removed arabic letters from the form handler. Fixes #40. AuthKit/trunk/authkit/authenticate/form.py
r167 r169 58 58 status="200 OK", 59 59 method='post', 60 action=None, 60 61 **p 61 62 ): … … 67 68 self.content_type = self.content_type + '; charset='+charset 68 69 self.method = method 70 self.action = action 69 71 70 72 def on_authorized(self, environ, start_response): … … 93 95 else: 94 96 log.debug("Either username or password missing") 95 action = construct_url(environ)97 action = self.action or construct_url(environ) 96 98 log.debug("Form action is: %s", action) 97 99 if self.method == 'post': … … 128 130 host, port = host.split(':', 1) 129 131 else: 130 host = environ.get('HTTP_X_FORWARDED_HOST', environ.get('HTTP_HOST')) 131 port = environ.get('HTTP_X_FORWARDED_PORT', environ.get('SERVER_PORT')) 132 133 # This is not a good way of determining the request scheme because 134 # the request could be proxied from an HTTPS server to an HTTP server 135 # if environ['wsgi.url_scheme'] == 'https': 136 # if port == '443': 137 # port = None 138 # elif environ['wsgi.url_scheme'] == 'http': 139 # if port == '80': 140 # port = None 132 # See if the request is proxied 133 host = environ.get('HTTP_X_FORWARDED_HOST', environ.get('HTTP_X_FORWARDED_FOR')) 134 if host is not None: 135 # Request was proxied, get the correct data 136 host = environ.get('HTTP_X_FORWARDED_HOST') 137 port = environ.get('HTTP_X_FORWARDED_PORT') 138 if port is None and environ.get('HTTP_X_FORWARDED_SSL') == 'on': 139 port = '443' 140 if not port: 141 log.warning( 142 'No HTTP_X_FORWARDED_PORT or HTTP_X_FORWARDED_SSL found ' 143 'in environment, cannot ' 144 'determine the correct port for the form action. ' 145 ) 146 if not host: 147 log.warning( 148 'No HTTP_X_FORWARDED_HOST found in environment, cannot ' 149 'determine the correct hostname for the form action. ' 150 'Using the value of HTTP_HOST instead.' 151 ) 152 host = environ.get('HTTP_HOST') 153 else: 154 # Request was not proxied 155 if environ['wsgi.url_scheme'] == 'https': 156 port = 443 157 if host is None: 158 host = environ.get('HTTP_HOST') 159 if port is None: 160 port = environ.get('SERVER_PORT') 141 161 url += host 142 162 if port: … … 146 166 url = 'http'+url 147 167 else: 148 if environ['wsgi.url_scheme'] == 'https': 149 url = 'https'+url+':%s' % port 150 else: 151 # Assume we are running HTTP on a non-standard port 152 url = 'http'+url+':%s' % port 153 168 # Assume we are running HTTP on a non-standard port 169 url = 'http'+url+':%s' % port 154 170 else: 155 171 url = 'http'+url … … 198 214 format='basic' 199 215 ) 200 charset=auth_conf.get('charset') 201 method =auth_conf.get('method', 'post') 216 charset = auth_conf.get('charset') 217 method = auth_conf.get('method', 'post') 218 action = auth_conf.get('action') 202 219 if method.lower() not in ['get','post']: 203 220 raise Exception('Form method should be GET or POST, not %s'%method) 204 return app, {'authfunc':authfunc, 'template':template_, 'charset':charset, 'method':method}, None 221 return app, { 222 'authfunc': authfunc, 223 'template': template_, 224 'charset': charset, 225 'method': method, 226 'action': action, 227 }, None 205 228 206 229 def make_form_handler( … … 226 249 charset=auth_handler_params['charset'], 227 250 method=auth_handler_params['method'], 251 action=auth_handler_params['action'], 228 252 ) 229 253 app.add_checker('form', status_checker) AuthKit/trunk/examples/docs/form.py
r121 r169 14 14 form_authenticate_user_encrypt_secret = 'some secret string', 15 15 form_charset='UTF-8', 16 # For overriding proxied defaults: 17 # form_action = 'http://localhost/forms/private', 16 18 cookie_signoutpath = '/signout', 17 19 )
