summaryrefslogtreecommitdiff
path: root/repoze/bfg/security.py
AgeCommit message (Collapse)Author
2010-10-25first pass at converting bfg to pyramid namespaceChris McDonough
2010-04-14Add "exception views" work contributed primarily by Andrey Popp by merging ↵Chris McDonough
the "phash" branch.
2010-01-24Merge reversepolarity branch.Chris McDonough
2009-12-30Spellcheck.Chris McDonough
2009-12-24Roles.Chris McDonough
2009-12-09- General documentation freshening which takes imperativeChris McDonough
configuration into account in more places and uses glossary references more liberally.
2009-11-25Import from the right package.Chris McDonough
2009-11-24Docs updates.Chris McDonough
2009-11-23 ``repoze.bfg.security.has_permission``Chris McDonough
``repoze.bfg.security.authenticated_userid`` ``repoze.bfg.security.effective_principals`` ``repoze.bfg.security.view_execution_permitted`` ``repoze.bfg.security.remember`` ``repoze.bfg.security.forget`` Each of these functions now expects to be called with a request object that has a ``registry`` attribute which represents the current ZCA registry. Previously these functions used the ZCA threadlocal API to get the current registry.
2009-09-30- The import of ``repoze.bfg.view.NotFound`` is deprecated in favor ofChris McDonough
``repoze.bfg.exceptions.NotFound``. The old location still functions, but emits a deprecation warning. - The import of ``repoze.bfg.security.Unauthorized`` is deprecated in favor of ``repoze.bfg.exceptions.Forbidden``. The old location still functions but emits a deprecation warning. The rename from ``Unauthorized`` to ``Forbidden`` brings parity to the the name of the exception and the system view it invokes when raised. - New ``repoze.bfg.exceptions`` module was created to house exceptions that were previously sprinkled through various modules. - An ``exceptions`` API chapter was added, documenting the new ``repoze.bfg.exceptions`` module.
2009-09-18Compulsive import reorderings.Chris McDonough
2009-09-06Remove 0.9 deprecations.Chris McDonough
2009-09-06Merge multiview2 branch to HEAD.Chris McDonough
2009-07-28- Fixed documentation bugs related to forget and remember in security APIChris McDonough
docs.
2009-06-27Fit reality.Chris McDonough
2009-05-30- Remove "context" argument from ``effective_principals`` andChris McDonough
``authenticated_userid`` function APIs in ``repoze.bfg.security``, effectively a doing reversion to 0.8 and before behavior. Both functions now again accept only the ``request`` parameter.
2009-05-27- Added deprecations for imports of ``ACLSecurityPolicy``,Chris McDonough
``InheritingACLSecurityPolicy``, ``RemoteUserACLSecurityPolicy``, ``RemoteUserInheritingACLSecurityPolicy``, ``WhoACLSecurityPolicy``, and ``WhoInheritingACLSecurityPolicy`` from the ``repoze.bfg.security`` module; for the meantime (for backwards compatibility purposes) these live in the ``repoze.bfg.secpols`` module. Note however, that the entire concept of a "security policy" is deprecated in BFG in favor of separate authentication and authorization policies, so any use of a security policy will generate additional deprecation warnings even if you do start using ``repoze.bfg.secpols``. ``repoze.bfg.secpols`` will disappear in a future release of ``repoze.bfg``.
2009-05-27Merge authchanges branch to trunk.Chris McDonough
2009-05-26Revert all work towards creating a "forbidden" API on the security policy; ↵Chris McDonough
I'll do this work on the authchanges branch first.
2009-05-25This doesn't belong here.Chris McDonough
2009-05-25Make sure the default forbidden response (when a secpol has no ↵Chris McDonough
``forbidden``) works properly.
2009-05-25Get rid of unfinished StandaloneSecurityPolicy.Chris McDonough
2009-05-25IForbiddenAppFactory -> IForbiddenResponseFactory.Chris McDonough
2009-05-25Change the semantics of IForbiddenAppFactory.Chris McDonough
2009-05-24FeaturesChris McDonough
-------- - It is now possible to write a custom security policy that returns a customized ``Forbidden`` WSGI application when BFG cannot authorize an invocation of a view. To this end, ISecurityPolicy objects must now have a ``forbidden`` method. This method should return a WSGI application. The returned WSGI application should generate a response which is appropriate when access to a view resource was forbidden by the security policy (e.g. perhaps a login page). ``repoze.bfg`` is willing to operate with a custom security policy that does not have a ``forbidden`` method, but it will issue a warning; eventually security policies without a ``forbidden`` method will cease to work under ``repoze.bfg``. Note that the ``forbidden`` WSGI application returned by the security policy is not used if a developer has registered an IForbiddenAppFactory (see the "Hooks" narrative chapter); the explicitly registered IForbiddenAppFactory will be preferred over the (more general) security policy forbidden app factory. - All default security policies now have a ``forbidden`` callable attached to them. This particular callable returns a WSGI application which generates a ``401 Unauthorized`` response for backwards compatibility (had backwards compatibility not been an issue, this callable would have returned a WSGI app that generated a ``403 Forbidden`` response). Backwards Incompatibilities --------------------------- - Custom NotFound and Forbidden (nee' Unauthorized) WSGI applications (registered a a utility for INotFoundAppFactory and IUnauthorizedAppFactory) could rely on an environment key named ``message`` describing the circumstance of the response. This key has been renamed to ``repoze.bfg.message`` (as per the WSGI spec, which requires environment extensions to contain dots). Deprecations ------------ - The ``repoze.bfg.interfaces.IUnauthorizedAppFactory`` interface has been renamed to ``repoze.bfg.interfaces.IForbiddenAppFactory``.
2009-05-09Typos.Chris McDonough
2009-05-06Thinko.Chris McDonough
2009-05-06FeaturesChris McDonough
-------- - Two new security policies were added: RemoteUserInheritingACLSecurityPolicy and WhoInheritingACLSecurityPolicy. These are security policies which take into account *all* ACLs defined in the lineage of a context rather than stopping at the first ACL found in a lineage. See the "Security" chapter of the API documentation for more information. - The API and narrative documentation dealing with security was changed to introduce the new "inheriting" security policy variants. - Added glossary entry for "lineage". Deprecations ------------ - The security policy previously named ``RepozeWhoIdentityACLSecurityPolicy`` now has the slightly saner name of ``WhoACLSecurityPolicy``. A deprecation warning is emitted when this policy is imported under the "old" name; usually this is due to its use in ZCML within your application. If you're getting this deprecation warning, change your ZCML to use the new name, e.g. change:: <utility provides="repoze.bfg.interfaces.ISecurityPolicy" factory="repoze.bfg.security.RepozeWhoIdentityACLSecurityPolicy" /> To:: <utility provides="repoze.bfg.interfaces.ISecurityPolicy" factory="repoze.bfg.security.WhoACLSecurityPolicy" />
2009-01-25- It is no longer permissible for a security ACE to contain a "nested"Chris McDonough
list of permissions (e.g. ``(Allow, Everyone, ['read', ['view', ['write', 'manage']]])`)`. The list must instead be fully expanded (e.g. ``(Allow, Everyone, ['read', 'view', 'write', 'manage])``). This feature was never documented, and was never an API, so it's not a backwards incompatibility.
2009-01-25Minor speed tweaks.Chris McDonough
2009-01-25- Get rid of ``repoze.bfg.security.ACLAuthorizer``: theChris McDonough
``ACLSecurityPolicy`` now does what it did inline. - Get rid of ``repoze.bfg.interfaces.NoAuthorizationInformation`` exception: it was used only by ``ACLAuthorizer``.
2009-01-25Speed tweak.Chris McDonough
2009-01-25- It is no longer permissible to pass a "nested" list of principals toChris McDonough
``repoze.bfg.ACLAuthorizer.permits`` (e.g. ['fred', ['larry', 'bob']). The principals list must be fully expanded. This feature was never documented, and was never an API, so it's not a backwards incompatibility.
2009-01-25Optimize flatten a bit.Chris McDonough
2009-01-24Behavior ChangesChris McDonough
---------------- - The ``repoze.bfg.view.render_view_to_response`` API will no longer raise a ValueError if an object returned by a view function it calls does not possess certain attributes (``headerlist``, ``app_iter``, ``status``). This API used to attempt to perform a check using the ``is_response`` function in ``repoze.bfg.view``, and raised a ``ValueError`` if the ``is_response`` check failed. The responsibility is now the caller's to ensure that the return value from a view function is a "real" response. - WSGI environ dicts passed to ``repoze.bfg`` 's Router must now contain a REQUEST_METHOD key/value; if they do not, a KeyError will be raised (speed). Implementation Changes ---------------------- - Various speed micro-tweaks.
2009-01-22- The Allowed and Denied classes in ``repoze.bfg.security`` now areChris McDonough
lazier about constructing the representation of a reason message for speed; ``repoze.bfg.view_execution_permitted`` takes advantage of this. - The ``is_response`` check was sped up by about half at the expense of making its code slightly uglier.
2009-01-17Security policy documentation.Chris McDonough
2009-01-11- Improve test coverage.Chris McDonough
- Remove old cold which attempts to recover from trying to unpickle a ``z3c.pt`` template; Chameleon has been the templating engine for a good long time now. Running repoze.bfg against a sandbox that has pickled ``z3c.pt`` templates it will now just fail with an unpickling error, but can be fixed by deleting the template cache files.
2008-11-02 - Fix bug where default deny in authorization check would throw aChris McDonough
TypeError (use ``ACLDenied`` instead of ``Denied``).
2008-11-02 FeaturesChris McDonough
- The ``BFG_DEBUG_AUTHORIZATION`` envvar and the ``debug_authorization`` config file value now only imply debugging of view-invoked security checks. Previously, information was printed for every call to ``has_permission`` as well, which made output confusing. To debug ``has_permission`` checks and other manual permission checks, use the debugger and print statements in your own code. - Authorization debugging info is now only present in the HTTP response body oif ``debug_authorization`` is true. - The format of authorization debug messages was improved. - A new ``BFG_DEBUG_NOTFOUND`` envvar was added and a symmetric ``debug_notfound`` config file value was added. When either is true, and a NotFound response is returned by the BFG router (because a view could not be found), debugging information is printed to stderr. When this value is set true, the body of HTTPNotFound responses will also contain the same debugging information. - ``Allowed`` and ``Denied`` responses from the security machinery are now specialized into two types: ACL types, and non-ACL types. The ACL-related responses are instances of ``repoze.bfg.security.ACLAllowed`` and ``repoze.bfg.security.ACLDenied``. The non-ACL-related responses are ``repoze.bfg.security.Allowed`` and ``repoze.bfg.security.Denied``. The allowed-type responses continue to evaluate equal to things that themselves evaluate equal to the ``True`` boolean, while the denied-type responses continue to evaluate equal to things that themselves evaluate equal to the ``False`` boolean. The only difference between the two types is the information attached to them for debugging purposes. - Added a new ``BFG_DEBUG_ALL`` envvar and a symmetric ``debug_all`` config file value. When either is true, all other debug-related flags are set true unconditionally (e.g. ``debug_notfound`` and ``debug_authorization``). Documentation - Added info about debug flag changes. - Added a section to the security chapter named "Debugging Imperative Authorization Failures" (for e.g. ``has_permssion``).
2008-11-01 - Expose a single ILogger named "repoze.bfg.debug" as a utility;Chris McDonough
this logger is registered unconditionally and is used by the authorization debug machinery. Applications may also make use of it as necessary rather than inventing their own logger, for convenience.
2008-10-11Unused imports.Chris McDonough
2008-10-03 Docs Chris McDonough
- An "Environment and Configuration" chapter was added to the narrative portion of the documentation. Features - Ensure bfg doesn't generate warnings when running under Python 2.6. - The environment variable ``BFG_RELOAD_TEMPLATES`` is now available (serves the same purpose as ``reload_templates`` in the config file). - A new configuration file option ``debug_authorization`` was added. This turns on printing of security authorization debug statements to ``sys.stderr``. The ``BFG_DEBUG_AUTHORIZATION`` environment variable was also added; this performs the same duty. Bug Fixes - The environment variable ``BFG_SECURITY_DEBUG`` did not always work. It has been renamed to ``BFG_DEBUG_AUTHORIZATION`` and fixed. Deprecations - A deprecation warning is now issued when old API names from the ``repoze.bfg.templates`` module are imported. Backwards incompatibilities - The ``BFG_SECURITY_DEBUG`` environment variable was renamed to ``BFG_DEBUG_AUTHORIZATION``.
2008-10-03Python 2.6 forward compatibility: message is deprecated.Chris McDonough
2008-09-28 FeaturesChris McDonough
- A ``repoze.bfg.location`` API module was added. Backwards incompatibilities - Applications must now use the ``repoze.bfg.interfaces.ILocation`` interface rather than ``zope.location.interfaces.ILocation`` to represent that a model object is "location-aware". We've removed a dependency on ``zope.location`` for cleanliness purposes: as new versions of zope libraries are released which have improved dependency information, getting rid of our dependence on ``zope.location`` will prevent a newly installed repoze.bfg application from requiring the ``zope.security``, egg, which not truly used at all in a "stock" repoze.bfg setup. These dependencies are still required by the stack at this time; this is purely a futureproofing move. The security and model documentation for previous versions of ``repoze.bfg`` recommended using the ``zope.location.interfaces.ILocation`` interface to represent that a model object is "location-aware". This documentation has been changed to reflect that this interface should now be imported from ``repoze.bfg.interfaces.ILocation`` instead.
2008-09-21 - Add ``principals_allowed_by_permission`` API to security module.Chris McDonough
2008-09-01 - New API module: ``repoze.bfg.view``. This module contains the functionsChris McDonough
named ``render_view_to_response``, ``render_view_to_iterable`` and ``is_response``, which are documented in the API docs. These features aid programmatic (non-request-driven) view execution.
2008-08-20Make seurity policies pickleable again.Chris McDonough
2008-08-17Add RepozeWhoIdentityACLSecurityPolicy; add debug logging.Chris McDonough
2008-07-20 - Add API functions for authenticated_userid and effective_principals.Chris McDonough