README.pyramid.rst
author Yann Voté <yann.vote@logilab.fr>
Mon, 26 Sep 2016 14:52:12 +0200
changeset 11631 faf279e33298
parent 11621 README.rst@5747d4c2e083
child 11681 b23d58050076
permissions -rw-r--r--
Merge with pyramid-cubicweb The following tasks have been done: - merge packaging files - merge documentation - move pyramid_cubicweb package at cubicweb/pyramid and update imports accordingly - rename tests directory into test - move pyramid-cubicweb README.rst into README.pyramid.rst until better idea - add a test dependency on unreleased cubicweb-pyramid to have both py27 and py34 tests pass Closes #14023058.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
11479
a070f211b35c Project Structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
     1
11621
5747d4c2e083 [doc] update a bit the documentation
David Douard <david.douard@logilab.fr>
parents: 11481
diff changeset
     2
pyramid_cubicweb_ is one specific way of integrating CubicWeb_ with a
5747d4c2e083 [doc] update a bit the documentation
David Douard <david.douard@logilab.fr>
parents: 11481
diff changeset
     3
Pyramid_ web application.
5747d4c2e083 [doc] update a bit the documentation
David Douard <david.douard@logilab.fr>
parents: 11481
diff changeset
     4
5747d4c2e083 [doc] update a bit the documentation
David Douard <david.douard@logilab.fr>
parents: 11481
diff changeset
     5
Features
5747d4c2e083 [doc] update a bit the documentation
David Douard <david.douard@logilab.fr>
parents: 11481
diff changeset
     6
========
11479
a070f211b35c Project Structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
     7
a070f211b35c Project Structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
     8
* provides a default route that let a cubicweb instance handle the request.
a070f211b35c Project Structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
     9
11621
5747d4c2e083 [doc] update a bit the documentation
David Douard <david.douard@logilab.fr>
parents: 11481
diff changeset
    10
Usage
5747d4c2e083 [doc] update a bit the documentation
David Douard <david.douard@logilab.fr>
parents: 11481
diff changeset
    11
=====
11479
a070f211b35c Project Structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    12
11621
5747d4c2e083 [doc] update a bit the documentation
David Douard <david.douard@logilab.fr>
parents: 11481
diff changeset
    13
To use, install ``pyramid_cubicweb`` in your python environment, and
5747d4c2e083 [doc] update a bit the documentation
David Douard <david.douard@logilab.fr>
parents: 11481
diff changeset
    14
then include_ the package::
11479
a070f211b35c Project Structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    15
a070f211b35c Project Structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    16
    config.include('pyramid_cubicweb')
a070f211b35c Project Structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    17
11621
5747d4c2e083 [doc] update a bit the documentation
David Douard <david.douard@logilab.fr>
parents: 11481
diff changeset
    18
    
5747d4c2e083 [doc] update a bit the documentation
David Douard <david.douard@logilab.fr>
parents: 11481
diff changeset
    19
Configuration
5747d4c2e083 [doc] update a bit the documentation
David Douard <david.douard@logilab.fr>
parents: 11481
diff changeset
    20
=============
5747d4c2e083 [doc] update a bit the documentation
David Douard <david.douard@logilab.fr>
parents: 11481
diff changeset
    21
5747d4c2e083 [doc] update a bit the documentation
David Douard <david.douard@logilab.fr>
parents: 11481
diff changeset
    22
Requires the following `INI setting / environment variable`_:
5747d4c2e083 [doc] update a bit the documentation
David Douard <david.douard@logilab.fr>
parents: 11481
diff changeset
    23
5747d4c2e083 [doc] update a bit the documentation
David Douard <david.douard@logilab.fr>
parents: 11481
diff changeset
    24
* `cubicweb.instance` / `CW_INSTANCE`: the cubicweb instance name
5747d4c2e083 [doc] update a bit the documentation
David Douard <david.douard@logilab.fr>
parents: 11481
diff changeset
    25
5747d4c2e083 [doc] update a bit the documentation
David Douard <david.douard@logilab.fr>
parents: 11481
diff changeset
    26
Authentication cookies
5747d4c2e083 [doc] update a bit the documentation
David Douard <david.douard@logilab.fr>
parents: 11481
diff changeset
    27
----------------------
11479
a070f211b35c Project Structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    28
11621
5747d4c2e083 [doc] update a bit the documentation
David Douard <david.douard@logilab.fr>
parents: 11481
diff changeset
    29
When using the `pyramid_cubicweb.auth` (CubicWeb AuthTkt
5747d4c2e083 [doc] update a bit the documentation
David Douard <david.douard@logilab.fr>
parents: 11481
diff changeset
    30
authentication policy), which is the default in most cases, you may
5747d4c2e083 [doc] update a bit the documentation
David Douard <david.douard@logilab.fr>
parents: 11481
diff changeset
    31
have to configure the behaviour of these authentication policies using
5747d4c2e083 [doc] update a bit the documentation
David Douard <david.douard@logilab.fr>
parents: 11481
diff changeset
    32
standard's Pyramid configuration. You may want to configure in your
5747d4c2e083 [doc] update a bit the documentation
David Douard <david.douard@logilab.fr>
parents: 11481
diff changeset
    33
``pyramid.ini``:
5747d4c2e083 [doc] update a bit the documentation
David Douard <david.douard@logilab.fr>
parents: 11481
diff changeset
    34
5747d4c2e083 [doc] update a bit the documentation
David Douard <david.douard@logilab.fr>
parents: 11481
diff changeset
    35
:Session Authentication:
11479
a070f211b35c Project Structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    36
11621
5747d4c2e083 [doc] update a bit the documentation
David Douard <david.douard@logilab.fr>
parents: 11481
diff changeset
    37
    This is a `AuthTktAuthenticationPolicy`_ so you may overwrite default
5747d4c2e083 [doc] update a bit the documentation
David Douard <david.douard@logilab.fr>
parents: 11481
diff changeset
    38
    configuration values by adding configuration entries using the prefix
5747d4c2e083 [doc] update a bit the documentation
David Douard <david.douard@logilab.fr>
parents: 11481
diff changeset
    39
    ``cubicweb.auth.authtkt.session``. Default values are:
5747d4c2e083 [doc] update a bit the documentation
David Douard <david.douard@logilab.fr>
parents: 11481
diff changeset
    40
5747d4c2e083 [doc] update a bit the documentation
David Douard <david.douard@logilab.fr>
parents: 11481
diff changeset
    41
    ::
5747d4c2e083 [doc] update a bit the documentation
David Douard <david.douard@logilab.fr>
parents: 11481
diff changeset
    42
5747d4c2e083 [doc] update a bit the documentation
David Douard <david.douard@logilab.fr>
parents: 11481
diff changeset
    43
        cubicweb.auth.authtkt.session.hashalg = sha512
5747d4c2e083 [doc] update a bit the documentation
David Douard <david.douard@logilab.fr>
parents: 11481
diff changeset
    44
        cubicweb.auth.authtkt.session.cookie_name = auth_tkt
5747d4c2e083 [doc] update a bit the documentation
David Douard <david.douard@logilab.fr>
parents: 11481
diff changeset
    45
        cubicweb.auth.authtkt.session.timeout = 1200
5747d4c2e083 [doc] update a bit the documentation
David Douard <david.douard@logilab.fr>
parents: 11481
diff changeset
    46
        cubicweb.auth.authtkt.session.reissue_time = 120
5747d4c2e083 [doc] update a bit the documentation
David Douard <david.douard@logilab.fr>
parents: 11481
diff changeset
    47
        cubicweb.auth.authtkt.session.http_only = True
5747d4c2e083 [doc] update a bit the documentation
David Douard <david.douard@logilab.fr>
parents: 11481
diff changeset
    48
        cubicweb.auth.authtkt.session.secure = True
11479
a070f211b35c Project Structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    49
a070f211b35c Project Structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    50
11621
5747d4c2e083 [doc] update a bit the documentation
David Douard <david.douard@logilab.fr>
parents: 11481
diff changeset
    51
:Persistent Authentication:
5747d4c2e083 [doc] update a bit the documentation
David Douard <david.douard@logilab.fr>
parents: 11481
diff changeset
    52
5747d4c2e083 [doc] update a bit the documentation
David Douard <david.douard@logilab.fr>
parents: 11481
diff changeset
    53
    This is also a `AuthTktAuthenticationPolicy`_. It is used when persistent
5747d4c2e083 [doc] update a bit the documentation
David Douard <david.douard@logilab.fr>
parents: 11481
diff changeset
    54
    sessions are activated (typically when using the cubicweb-rememberme_
5747d4c2e083 [doc] update a bit the documentation
David Douard <david.douard@logilab.fr>
parents: 11481
diff changeset
    55
    cube). You may overwrite default configuration values by adding
5747d4c2e083 [doc] update a bit the documentation
David Douard <david.douard@logilab.fr>
parents: 11481
diff changeset
    56
    configuration entries using the prefix
5747d4c2e083 [doc] update a bit the documentation
David Douard <david.douard@logilab.fr>
parents: 11481
diff changeset
    57
    ``cubicweb.auth.authtkt.persistent``. Default values are:
5747d4c2e083 [doc] update a bit the documentation
David Douard <david.douard@logilab.fr>
parents: 11481
diff changeset
    58
5747d4c2e083 [doc] update a bit the documentation
David Douard <david.douard@logilab.fr>
parents: 11481
diff changeset
    59
    ::
5747d4c2e083 [doc] update a bit the documentation
David Douard <david.douard@logilab.fr>
parents: 11481
diff changeset
    60
5747d4c2e083 [doc] update a bit the documentation
David Douard <david.douard@logilab.fr>
parents: 11481
diff changeset
    61
        cubicweb.auth.authtkt.persistent.hashalg = sha512
5747d4c2e083 [doc] update a bit the documentation
David Douard <david.douard@logilab.fr>
parents: 11481
diff changeset
    62
        cubicweb.auth.authtkt.persistent.cookie_name = pauth_tkt
5747d4c2e083 [doc] update a bit the documentation
David Douard <david.douard@logilab.fr>
parents: 11481
diff changeset
    63
        cubicweb.auth.authtkt.persistent.max_age = 3600*24*30
5747d4c2e083 [doc] update a bit the documentation
David Douard <david.douard@logilab.fr>
parents: 11481
diff changeset
    64
        cubicweb.auth.authtkt.persistent.reissue_time = 3600*24
5747d4c2e083 [doc] update a bit the documentation
David Douard <david.douard@logilab.fr>
parents: 11481
diff changeset
    65
        cubicweb.auth.authtkt.persistent.http_only = True
5747d4c2e083 [doc] update a bit the documentation
David Douard <david.douard@logilab.fr>
parents: 11481
diff changeset
    66
        cubicweb.auth.authtkt.persistent.secure = True
5747d4c2e083 [doc] update a bit the documentation
David Douard <david.douard@logilab.fr>
parents: 11481
diff changeset
    67
5747d4c2e083 [doc] update a bit the documentation
David Douard <david.douard@logilab.fr>
parents: 11481
diff changeset
    68
5747d4c2e083 [doc] update a bit the documentation
David Douard <david.douard@logilab.fr>
parents: 11481
diff changeset
    69
.. Warning:: Legacy timeout values from the instance's
5747d4c2e083 [doc] update a bit the documentation
David Douard <david.douard@logilab.fr>
parents: 11481
diff changeset
    70
             ``all-in-one.conf`` are **not** used at all (``
5747d4c2e083 [doc] update a bit the documentation
David Douard <david.douard@logilab.fr>
parents: 11481
diff changeset
    71
             http-session-time`` and ``cleanup-session-time``)
5747d4c2e083 [doc] update a bit the documentation
David Douard <david.douard@logilab.fr>
parents: 11481
diff changeset
    72
5747d4c2e083 [doc] update a bit the documentation
David Douard <david.douard@logilab.fr>
parents: 11481
diff changeset
    73
Please refer to the documentation_ for more details (available in the
5747d4c2e083 [doc] update a bit the documentation
David Douard <david.douard@logilab.fr>
parents: 11481
diff changeset
    74
``docs`` directory of the source code).
5747d4c2e083 [doc] update a bit the documentation
David Douard <david.douard@logilab.fr>
parents: 11481
diff changeset
    75
5747d4c2e083 [doc] update a bit the documentation
David Douard <david.douard@logilab.fr>
parents: 11481
diff changeset
    76
.. _pyramid_cubicweb: https://www.cubicweb.org/project/pyramid-cubicweb
5747d4c2e083 [doc] update a bit the documentation
David Douard <david.douard@logilab.fr>
parents: 11481
diff changeset
    77
.. _CubicWeb: https://www.cubicweb.org/
5747d4c2e083 [doc] update a bit the documentation
David Douard <david.douard@logilab.fr>
parents: 11481
diff changeset
    78
.. _`cubicweb-rememberme`: \
5747d4c2e083 [doc] update a bit the documentation
David Douard <david.douard@logilab.fr>
parents: 11481
diff changeset
    79
    https://www.cubicweb.org/project/cubicweb-rememberme
5747d4c2e083 [doc] update a bit the documentation
David Douard <david.douard@logilab.fr>
parents: 11481
diff changeset
    80
.. _Pyramid: http://pypi.python.org/pypi/pyramid
5747d4c2e083 [doc] update a bit the documentation
David Douard <david.douard@logilab.fr>
parents: 11481
diff changeset
    81
.. _include: http://docs.pylonsproject.org/projects/pyramid/en/latest/api/config.html#pyramid.config.Configurator.include
5747d4c2e083 [doc] update a bit the documentation
David Douard <david.douard@logilab.fr>
parents: 11481
diff changeset
    82
.. _`INI setting / environment variable`: http://docs.pylonsproject.org/projects/pyramid/en/latest/narr/environment.html#adding-a-custom-setting
5747d4c2e083 [doc] update a bit the documentation
David Douard <david.douard@logilab.fr>
parents: 11481
diff changeset
    83
.. _documentation: http://pyramid-cubicweb.readthedocs.org/
5747d4c2e083 [doc] update a bit the documentation
David Douard <david.douard@logilab.fr>
parents: 11481
diff changeset
    84
.. _AuthTktAuthenticationPolicy: \
5747d4c2e083 [doc] update a bit the documentation
David Douard <david.douard@logilab.fr>
parents: 11481
diff changeset
    85
    http://docs.pylonsproject.org/projects/pyramid/en/latest/api/authentication.html#pyramid.authentication.AuthTktAuthenticationPolicy