Changeset 5752

Show
Ignore:
Timestamp:
11/23/08 12:07:28 (2 months ago)
Author:
Gustavo
Message:

Moved the main page on auth to a better location

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • docs/2.0/docs/index.rst

    r5749 r5752  
    4141   main/Wiki20/wiki20 
    4242   main/ToscaWidgets/forms 
    43    main/Auth 
     43   main/Auth/index 
    4444 
    4545What's new in TG2 
  • docs/2.0/docs/main/Auth/index.rst

    • Property svn:mergeinfo set
    r5611 r5752  
    66This documents describes how to implement authentication and authorization in 
    77TG 2 applications. Although there are other ways to implement it (e.g., using 
    8 the `AuthKit <http://authkit.org/>`_ package or a project-specific solution),  
     8the `AuthKit <http://authkit.org/>`_ package or a project-specific solution), 
    99this document only describes the officially supported and recommended way. 
    1010 
     
    1515-------- 
    1616 
    17 ``Authentication`` is the act verifying that somebody is really who she claims  
     17``Authentication`` is the act verifying that somebody is really who she claims 
    1818to be, which is normally done using credentials (e.g., when you need to access 
    1919your email, you provide the email address and your password, or if you want 
     
    2626pictures while others cannot. In other words, finding `what` you may do. 
    2727 
    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: 
     28TurboGears 2 applications may take advantage of a robust, extendable, pluggable 
     29and easy-to-use system for authentication and authorization suitable for nearly 
     30all situations — in fact, you may extend it to suite your needs if it doesn't, 
     31which should be really simple in most situations. Such a system is made up of 
     32two independent components, well integrated into TurboGears: 
    3333 
    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. 
    4242 
    4343You may store your users' credentials where you want (e.g., in a database, an 
    4444LDAP server, an Htaccess file) and also store your authorization settings 
    4545in any type of source (e.g., in a database, Ini file) -- if the back-end you 
    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  
     46need is not available, you may create it yourself (which is usually very easy). 
     47And don't worry if you need to change the back-end afterwards: You would not 
     48need to touch your code! Except, of course, the snippet that tells where the 
    4949data may be found. 
    5050 
     
    5353------------------------------------------------ 
    5454 
    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  
     56or 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 
     58other conditions (such as checking that the user comes from a given country,  
     59based on her IP address, for example). 
    6060 
    61 The authentication framework (:mod:`repoze.who`) only deals with the  
    62 :term:`source` (or sources) that handle your users' credentials, while the  
    63 authorization framework (:mod:`tgext.authorization`) deals with both the  
     61The authentication framework (:mod:`repoze.who`) only deals with the 
     62source(s) that handle your users' credentials, while the 
     63authorization framework (:mod:`repoze.what`) deals with both the 
    6464source(s) that handle your groups and those that handle your permissions. 
    6565 
     
    6868------------------------ 
    6969 
    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. 
     70While :mod:`repoze.what` only deals with authorization, its SQL plugin  
     71provides a module to setup authentication via :mod:`repoze.who` so that you can  
     72get started with authentication and authorization very quickly. It may be  
     73enabled while creating the TG2 project or afterwards, and it may be easily  
     74replaced by a custom solution. 
    7575 
    76 To use it on a new projet, just answer "yes" during the `paster quickstart`  
     76To use it on a new projet, just answer "yes" during the `paster quickstart` 
    7777process when it asks you if you want auth:: 
    78   
     78 
    7979  Do you need authentication and authorization in this project? [yes] 
    8080 
    8181You'll then get authentication and authorization code added for you, including 
    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.  
     82the SQLAlchemy-powered model definitions in ``{yourpackage}.model.auth`` and 
     83the relevant settings in ``{yourpackage}.config.app_cfg``. It also defines the 
     84default users, groups and permissions in ``{yourpackage}.websetup``, which you 
     85may want to customize. 
    8686 
    8787Before trying to login and try authorization with the rows defined in 
     
    9292 
    9393.. note:: 
    94   This module is :mod:`tgext.authorization.quickstart` and only works if your  
    95   users' credentials, groups and permissions are stored in a `SQLAlchemy  
    96   <http://www.sqlalchemy.org/>`_-managed database. To implement it on an  
     94  This module is :mod:`repoze.what.plugins.quickstart` and only works if your 
     95  users' credentials, groups and permissions are stored in a `SQLAlchemy 
     96  <http://www.sqlalchemy.org/>`_-managed database. To implement it on an 
    9797  existing project, or customize the model structure assumed by it, you have to 
    98   read the documentation for :mod:`tgext.authorization.quickstart`. 
     98  read the documentation for :mod:`repoze.what.quickstart`. 
    9999 
    100100 
     
    102102--------------------- 
    103103 
    104 If you need more power than that provided by the quickstart, or if you just  
     104If you need more power than that provided by the quickstart, or if you just 
    105105want to customize some things, you may want to read the following pages: 
    106106 
     
    108108    :maxdepth: 2 
    109109 
    110     Auth/Authentication 
    111     Extensions/Authorization/index 
     110    Authentication 
     111    Authorization 
     112    Customization