{ "info": { "author": "James Arthur", "author_email": "username: thruflo, domain: gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Environment :: Web Environment", "Framework :: Pylons", "Intended Audience :: Developers", "License :: Public Domain", "Natural Language :: English", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.2", "Topic :: Internet :: WWW/HTTP", "Topic :: Internet :: WWW/HTTP :: WSGI", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "[](https://travis-ci.org/thruflo/pyramid_simpleauth)\n\n[pyramid_simpleauth][] is a package that implements session based authentication\nand role based security for a [Pyramid][] web application.\n\nThere are many other auth implementations for Pyramid, including [apex][] and \n[pyramid_signup][] and you can, of course, easily roll your own, for example\nfollowing the excellent [pyramid_auth_demo][]. This package aims to be:\n\n* relatively simple: with a limited feature set\n* extensible: with event hooks and overrideable templates\n* performant: minimising db queries\n\n# Features\n\nIf you install the package and include it in your Pyramid application, it will\nlock down your application and expose views at:\n\n* /auth/signup\n* /auth/login\n* /auth/authenticate (login via AJAX)\n* /auth/logout\n* /auth/change\\_username\n* /auth/change\\_password\n* /auth/confirm (email confirmation)\n* /auth/prefer\\_email (set email as the user's preferred email)\n\nYou get a `user` instance and an `is_authenticated` flag added to the `request`:\n\n # e.g.: in a view callable\n if request.is_authenticated:\n display = request.user.username\n\nPlus `UserSignedUp`, `UserloggedIn`, `UserLoggedOut`, `UserChangedPassword`,\n`UserChangedUsername`, `EmailPreferred` and `EmailAddressConfirmed` events to\nsubscribe to:\n\n @subscriber(UserSignedUp)\n def my_event_handler(event):\n request = event.request\n user = event.user\n # e.g.: send confirmation email\n\nFlags at `request.is_post_login` and `request.is_post_signup`, stored in the session, \nthat allow you to test whether the current request is immediately after a login or \nsignup event. And a `request.user_json` property (useful to write into a template \nto pass data to the client side).\n\n`model.get_confirmation_link(request, email)` returns a `confirmation_link`\nthat will be accepted by `/auth/confirm` and that can typically be included in\nan email sent to a user who wish to validate an email address.\n\nThe `EmailAddressConfirmed` and `EmailPreferred` events give you access to the\n`Email` object as `event.data['email']`, eg:\n\n @subscriber(EmailAddressConfirmed)\n def email_address_confirmed(event):\n email_address = event.data['email'].address\n session = event.request.session\n session.flash(\"%s has been confirmed successfully\" % email_address)\n\n\n# Install\n\nInstall using `pip` or `easy_install`, e.g.:\n\n pip install pyramid_simpleauth\n\n# Configure\n\nInclude the package along with a session factory, `pyramid_tm` and `pyramid_basemodel`\nin the configuration portion of your Pyramid app:\n\n # Configure a session factory, here, we're using `pyramid_beaker`.\n config.include('pyramid_beaker')\n config.set_session_factory(session_factory_from_settings(settings))\n \n # Either include `pyramid_tm` or deal with committing transactions yourself.\n config.include('pyramid_tm')\n \n # Either include `pyramid_basemodel` and provide an `sqlalchemy.url` in your\n # `.ini` settings, or bind the SQLAlchemy models and scoped `Session` to a\n # database engine yourself.\n config.include('pyramid_basemodel')\n \n # Include the package.\n config.include('pyramid_simpleauth')\n\nThe signup and login forms inherit from a base layout template. You can override\nthis base layout template by writing your own, e.g.:\n\n # my_package:my_templates/layout.mako\n \n \n
\n