Skip to main content

An identity policy for morepath using itsdangerous.

Project description

Usage

import morepath
from more.itsdangerous import IdentityPolicy

class App(morepath.App):
    pass

@App.identity_policy()
def get_identity_policy():
    return IdentityPolicy()

@App.verify_identity()
def verify_identity(identity):
    # trust the identity established by the identity policy (we could keep
    # checking if the user is really in the database here - or if it was
    # removed in the meantime)
    return True

See http://morepath.readthedocs.org/en/latest/security.html to learn more about Morepath’s security model and and have a look at the commented source code:

https://github.com/morepath/more.itsdangerous/blob/master/more/itsdangerous/identity_policy.py

The IdentityPolicy class is meant to be extended because everyone has differing needs. It simply provides a way to store the identity as a signed cookie, using itsdangerous.

Usage in Development

By default, the cookies created by more.itsdangerous are HttpOnly and Secure.

If you have differing needs or if you are running a development server you might have to change the identity policy’s configuration:

@App.identity_policy()
def get_identity_policy():
    # make the cookies work under http, not just https
    return IdentityPolicy(secure=False)

Note that this should only be used in development. In this day and age you do not want to transmit cookies over http!

Run the Tests

Install tox and run it:

pip install tox
tox

Limit the tests to a specific python version:

tox -e py27

Conventions

More Itsdangerous follows PEP8 as close as possible. To test for it run:

tox -e pep8

More Itsdangerous uses Semantic Versioning

Build Status

Build Status

Coverage

Project Coverage

Latests PyPI Release

Latest PyPI Release

License

more.itsdangerous is released under the revised BSD license

Changelog

Unreleased

0.0.1 (2015-04-29)

  • Initial Release [href]

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

more.itsdangerous-0.0.1.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

more.itsdangerous-0.0.1-py2-none-any.whl (8.7 kB view details)

Uploaded Python 2

File details

Details for the file more.itsdangerous-0.0.1.tar.gz.

File metadata

File hashes

Hashes for more.itsdangerous-0.0.1.tar.gz
Algorithm Hash digest
SHA256 4b7ae016f9723dcd69b8eb29e401afdfbc0deb02ae96375d54790dc74e22a5e0
MD5 e465d0bc97f03e9d049d77f48fd4e19b
BLAKE2b-256 5c3ccbca2910e0bde7c89e6ba4b1fcdac573b28f095e92f7535c0a355b862fdb

See more details on using hashes here.

File details

Details for the file more.itsdangerous-0.0.1-py2-none-any.whl.

File metadata

File hashes

Hashes for more.itsdangerous-0.0.1-py2-none-any.whl
Algorithm Hash digest
SHA256 e47b4cc442d2f0a3471f22e4918c6ca33ddb8bfed20055006347db72aadb65e9
MD5 0cfbb9cd5bd53b44013503cfb85031ad
BLAKE2b-256 2e84f6b0f5512c547c59cdaacf474d664cd2bbb87bd63771abb0dfe3b5e1b25d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page