| 28 | | TurboGears 2 applications may take advantage of a robust, extendable, pluggable |
|---|
| 29 | | and easy-to-use system for authentication and authorization suitable for nearly |
|---|
| 30 | | all situations — in fact, you may extend it to suite your needs if it doesn't, |
|---|
| 31 | | which should be really simple in most situations. Such a system is made up of |
|---|
| 32 | | two components, well integrated into TurboGears: |
|---|
| | 28 | TurboGears 2 applications may take advantage of a robust, extendable, pluggable |
|---|
| | 29 | and easy-to-use system for authentication and authorization suitable for nearly |
|---|
| | 30 | all situations — in fact, you may extend it to suite your needs if it doesn't, |
|---|
| | 31 | which should be really simple in most situations. Such a system is made up of |
|---|
| | 32 | two independent components, well integrated into TurboGears: |
|---|
| 34 | | * :mod:`repoze.who`, a TurboGears-independent framework for |
|---|
| 35 | | ``authentication`` in WSGI applications. You normally don't have to care |
|---|
| 36 | | about it because by default TG2 applications ship all the code to set it up |
|---|
| 37 | | (as long as you had selected such an option when you created the project), |
|---|
| 38 | | but if you need something more advanced you are in the right place. |
|---|
| 39 | | * :mod:`tgext.authorization`, a TurboGears 2 specific framework for |
|---|
| 40 | | ``authorization`` which is backwards compatible with the TurboGears 1 |
|---|
| 41 | | Identity authorization system. |
|---|
| | 34 | * :mod:`repoze.who`, a framework for ``authentication`` in WSGI applications. |
|---|
| | 35 | You normally don't have to care about it because by default TG2 |
|---|
| | 36 | applications ship all the code to set it up (as long as you had selected |
|---|
| | 37 | such an option when you created the project), but if you need something |
|---|
| | 38 | more advanced you are at the right place. |
|---|
| | 39 | * :mod:`repoze.what`, a framework for ``authorization`` which is mostly |
|---|
| | 40 | compatible with the TurboGears 1.x `Identity` authentication and |
|---|
| | 41 | authorization system. |
|---|
| 46 | | need is not available, you may create it yourself (which is usually very easy). |
|---|
| 47 | | And don't worry if you need to change the back-end afterwards: You would not |
|---|
| 48 | | need to touch your code! Except, of course, the snippet that tells where the |
|---|
| | 46 | need is not available, you may create it yourself (which is usually very easy). |
|---|
| | 47 | And don't worry if you need to change the back-end afterwards: You would not |
|---|
| | 48 | need to touch your code! Except, of course, the snippet that tells where the |
|---|
| 55 | | Authorization in TurboGears 2 applications uses a common pattern based on |
|---|
| 56 | | the ``users`` (authenticated or anonymous) of your web application, the |
|---|
| 57 | | ``groups`` they belong to and the ``permissions`` granted to such groups. But |
|---|
| 58 | | you can extend it to check for other conditions (such as checking that the |
|---|
| 59 | | user comes from a given country, based on her IP address, for example). |
|---|
| | 55 | :mod:`repoze.what` uses a common pattern based on the ``users`` (authenticated |
|---|
| | 56 | or anonymous) of your web application, the ``groups`` they belong to and the |
|---|
| | 57 | ``permissions`` granted to such groups. But you can extend it to check for many |
|---|
| | 58 | other conditions (such as checking that the user comes from a given country, |
|---|
| | 59 | based on her IP address, for example). |
|---|
| 70 | | While :mod:`tgext.authorization` only deals with authorization, it provides a |
|---|
| 71 | | module to setup authentication via :mod:`repoze.who` so that you can get started |
|---|
| 72 | | with authentication and authorization very quickly. It may be enabled while |
|---|
| 73 | | creating the TG2 project or afterwards, and it may be easily replaced by a |
|---|
| 74 | | custom solution. |
|---|
| | 70 | While :mod:`repoze.what` only deals with authorization, its SQL plugin |
|---|
| | 71 | provides a module to setup authentication via :mod:`repoze.who` so that you can |
|---|
| | 72 | get started with authentication and authorization very quickly. It may be |
|---|
| | 73 | enabled while creating the TG2 project or afterwards, and it may be easily |
|---|
| | 74 | replaced by a custom solution. |
|---|
| 82 | | the SQLAlchemy-powered model definitions in ``{yourpackage}.model.auth`` and |
|---|
| 83 | | the relevant settings in ``{yourpackage}.config.app_cfg``. It also defines the |
|---|
| 84 | | default users, groups and permissions in ``{yourpackage}.websetup``, which you |
|---|
| 85 | | may want to customize. |
|---|
| | 82 | the SQLAlchemy-powered model definitions in ``{yourpackage}.model.auth`` and |
|---|
| | 83 | the relevant settings in ``{yourpackage}.config.app_cfg``. It also defines the |
|---|
| | 84 | default users, groups and permissions in ``{yourpackage}.websetup``, which you |
|---|
| | 85 | may want to customize. |
|---|