Ńň Ń˙ŤIc@s“dZddkZddklZddklZddklZlZddk l Z l Z ddgZ de fd „ƒYZddd „ZdS( s^ Utilities to setup authorization by configuring repoze.who's middleware to use repoze.what. i˙˙˙˙N(t implements(tmake_middleware(tdefault_challenge_decidertdefault_request_classifier(tIAuthenticatortIMetadataProvidertAuthorizationMetadatat setup_authcBs9eZdZeeƒddd„Zd„Zd„ZRS(s repoze.who metadata provider to load groups and permissions data for the current user. There's no need to include this class in the end-user documentation, as there's no reason why they may ever need it... It's only by :func:`setup_auth`. cCs||_||_dS(s Fetch the groups and permissions of the authenticated user. :param group_adapters: Set of adapters that retrieve the known groups of the application, each identified by a keyword. :type group_adapters: dict :param permission_adapters: Set of adapters that retrieve the permissions for the groups, each identified by a keyword. :type permission_adapters: dict N(tgroup_adapterstpermission_adapters(tselfRR ((s:/usr/lib/python2.6/site-packages/repoze/what/middleware.pyt__init__0s cCsÍtƒ}tƒ}|idj o•|iƒ}|d|d` and its :func:`setup_sql_auth() ` function. You must define the ``group_adapters`` and ``permission_adapters`` keyword arguments if you want to use the groups/permissions-based authorization pattern. Additional keyword arguments will be passed to :func:`repoze.who.plugins.testutil.make_middleware` -- and among those keyword arguments, you *must* define at least the identifier(s), authenticator(s) and challenger(s) to be used. For example:: from repoze.who.plugins.basicauth import BasicAuthPlugin from repoze.who.plugins.htpasswd import HTPasswdPlugin, crypt_check from repoze.what.middleware import setup_auth from repoze.what.plugins.xml import XMLGroupsAdapter from repoze.what.plugins.ini import INIPermissionAdapter # Defining the group adapters; you may add as much as you need: groups = {'all_groups': XMLGroupsAdapter('/path/to/groups.xml')} # Defining the permission adapters; you may add as much as you need: permissions = {'all_perms': INIPermissionAdapter('/path/to/perms.ini')} # repoze.who identifiers; you may add as much as you need: basicauth = BasicAuthPlugin('Private web site') identifiers = [('basicauth', basicauth)] # repoze.who authenticators; you may add as much as you need: htpasswd_auth = HTPasswdPlugin('/path/to/users.htpasswd', crypt_check) authenticators = [('htpasswd', htpasswd_auth)] # repoze.who challengers; you may add as much as you need: challengers = [('basicauth', basicauth)] app_with_auth = setup_auth( app, groups, permissions, identifiers=identifiers, authenticators=authenticators, challengers=challengers) .. attention:: Keep in mind that :mod:`repoze.who` must be configured `through` :mod:`repoze.what` for authorization to work. .. note:: If you want to skip authentication while testing your application, you should pass the ``skip_authentication`` keyword argument with a value that evaluates to ``True``. .. versionchanged:: 1.0.5 :class:`repoze.who.middleware.PluggableAuthenticationMiddleware` replaced with :func:`repoze.who.plugins.testutil.make_middleware` internally. t mdproviderstauthorization_mdt classifiertchallenge_decidertAUTH_LOGi˙˙˙˙Nt log_streamtskip_authentication( RtappendRRtosRRtsyststdouttpoptFalseR(tappRR twho_argst authorizationR-t skip_authnt middleware((s:/usr/lib/python2.6/site-packages/repoze/what/middleware.pyRzsL     (R#R,tzope.interfaceRtrepoze.who.plugins.testutilRtrepoze.who.classifiersRRtrepoze.who.interfacesRRt__all__tobjectRR R(((s:/usr/lib/python2.6/site-packages/repoze/what/middleware.pyts  W