6 messages in com.googlegroups.pylons-discussRe: Authkit 0.3.0pre5dev_r92 + Pylons...
FromSent OnAttachments
Jose Figueras27 Sep 2007 12:38 
James Gardner27 Sep 2007 13:07 
Jose Figueras27 Sep 2007 21:15 
Jose Figueras27 Sep 2007 21:19 
Jose Figueras03 Oct 2007 15:43 
Jose Figueras03 Oct 2007 15:45 
Subject:Re: Authkit 0.3.0pre5dev_r92 + Pylons 0.9.6rc2 doesn't works?
From:Jose Figueras (jfma@public.gmane.org)
Date:09/27/2007 09:15:03 PM
List:com.googlegroups.pylons-discuss

Thank you James for your quick answer.

I'll try 0.4 next monday then.

Jose F.

On 27 sep, 22:07, James Gardner <ja..@public.gmane.org>
wrote:

Hi Jose,

The documentation is for AuthKit 0.4
fromhttp://authkit.org/svn/AuthKit/branches/0.4I'm going to make a release at the weekend.

The problem might be because Pylons 0.9.6 doesn't have the httpexceptions middleware.

Try using AuthKit 0.4 and things are more likely to work.

I've put a note at the top of the chapter. Apologies for not making it clear.

James

Jose Figueras wrote:

Hello,

Following authkit documentation (see http://wiki.pylonshq.com/display/pysbook/Authentication+and+Authoriza...), it's impossible to me add security in my pylons app:

1) if I include authentication code I, ever, receive 401 error:

authkit.authorize.NotAuthenticatedError: 401 Not Authenticated The server could not comply with the request since it is either malformed or otherwise incorrect. Not Authenticated

2) only surpass this error if I add, on "development.ini" pylons configuration file, 500 code error on "authkit.catch" option. But, then, authkit catch all my app errors!!!. Certainly works but...

3) if I include authorization code, my webapp shows:

Internal Server Error

Could you help me to discover where is the source of the problem?

----

Here you are (part of) my development.ini file:

... # AuthKit configuration authkit.enable = true authkit.method = forward authkit.cookie.secret = secret_string authkit.signin = /login/signin authkit.cookie.signout = /login/signout authkit.catch = 401, 403 ...

Here you are (part of) my middleware.py file:

... def make_app(global_conf, full_stack=True, **app_conf): """Create a WSGI application and return it

global_conf is a dict representing the Paste configuration options, the paste.deploy.converters should be used when parsing Paste config options to ensure they're treated properly. """ # Load our Pylons configuration defaults load_environment(global_conf, app_conf)

# Load our default Pylons WSGI app and make g available # app = pylons.wsgiapp.PylonsApp(helpers=kmauto_management.lib.helpers, # g=app_globals.Globals) # app = ConfigMiddleware(app, config._current_obj()) app = pylons.wsgiapp.PylonsApp()

# YOUR MIDDLEWARE # Put your own middleware here, so that any problems are caught # by the error handling middleware underneath

# Setup ToscaWidgets from toscawidgets.view import EngineManager from toscawidgets.middleware import TGWidgetsMiddleware from toscawidgets.mods.pylonshf import PylonsHostFramework from pylons.templating import render

def extra_vars(): return dict( py_c=pylons.c._current_obj(), g=pylons.g._current_obj(), h=kmauto_management.lib.helpers, render=render, request=pylons.request._current_obj(), session=pylons.session._current_obj(), translator=pylons.translator, ungettext=pylons.i18n.ungettext, _=pylons.i18n._, N_=pylons.i18n.N_ )

class CustomHostFramework(PylonsHostFramework): engines = EngineManager(extra_vars_func=extra_vars) engines.load_all({'mako.directories': config['pylons.paths'] ['templates']})

app = TGWidgetsMiddleware(app, CustomHostFramework)

# If errror handling will be handled by middleware for multiple apps, you # will want to set full_stack = False in your config file so that it can # catch the problems. if asbool(full_stack): # Error Handling app = ErrorHandler(app, global_conf, error_template=error_template, **config['pylons.errorware'])

# Authorization #
@refhttp://wiki.pylonshq.com/display/pysbook/Authentication+and+Authoriza... import authkit.authorize from authkit.permissions import ValidAuthKitUser app = authkit.authorize.middleware(app, ValidAuthKitUser()) # Authentication import authkit.authenticate app = authkit.authenticate.middleware(app, app_conf)

# Display error documents for 401, 403, 404 status codes # (if debug is disabled also intercepts 500) app = ErrorDocuments(app, global_conf, mapper=error_mapper, **app_conf)

# Establish the Registry for this application app = RegistryManager(app)

static_app = StaticURLParser(config['pylons.paths'] ['static_files']) javascripts_app = StaticJavascripts() app = Cascade([static_app, javascripts_app, app]) return app

----

Regards, Jose F.