Coder Social home page Coder Social logo

more.itsdangerous's Introduction

More Itsdangerous

An identity policy for morepath using itsdangerous.

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

more.itsdangerous's People

Contributors

henri-hulski avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.