{ "info": { "author": "Max Thayer", "author_email": "garbados@gmail.com", "bugtrack_url": null, "classifiers": [ "Environment :: Web Environment", "Intended Audience :: Developers", "Operating System :: OS Independent", "Programming Language :: Python", "Topic :: Internet :: WWW/HTTP :: Dynamic Content", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "# Flask-BrowserID\r\n\r\nA Flask extension that provides integration with Mozilla's [BrowserID]() authentication system and Flask-Login. It exposes two routes, for login and logout, and a javascript authentication bundle that allows you to quickly create login and logout buttons.\r\n\r\n# Installation\r\n\r\nInstall with **pip**:\r\n\r\n pip install git+https://github.com/garbados/flask-browserid.git\r\n\r\n# Quickstart\r\n\r\nFlask-BrowserID requires that Flask-Login's LoginManager be configured and registered with the app first, like so:\r\n\r\n from flask import Flask\r\n from flask.ext.login import LoginManager\r\n from flask.ext.login import BrowserID\r\n from my_stuff import get_user_by_id # finds a user by their id\r\n from other_stuff import get_user # finds a user based on BrowserID response\r\n\r\n app = Flask(__name__)\r\n \r\n login_manager = LoginManager()\r\n login_manager.user_loader(get_user_by_id)\r\n login_manager.init_app(app)\r\n\r\n browser_id = BrowserID()\r\n browser_id.user_loader(get_user)\r\n browser_id.init_app(app)\r\n\r\nNow the routes `/api/login` and `/api/logout` have been registered with your app. A javascript bundle, `auth_script`, has also been added to the top level of your request context, so you can access it in templates like so:\r\n\r\n[Note: `auth_script` requires JQuery and Mozilla's `include.js`]\r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n {% if current_user.is_authenticated() %}\r\n \r\n {% else %} \r\n \r\n {% endif %}\r\n \r\n \r\n\r\nThanks to `auth_script`, clicking the `Login` button on that page will attempt to log you in using BrowserID. If you're already logged in, then clicking `Logout` will log you out.\r\n\r\n# Required Configuration\r\n\r\nFlask-BrowserID requires a function that takes the data returned by BrowserID and uses it to find and return a user, which Flask-BrowserID then logs in using Flask-Login. If the function can't find a user, it can attempt to create a user using the data given. If a user could neither be found nor created, the function should return None. The data returned by BrowserID will look something like this if successful:\r\n\r\n {\r\n \"status\": \"okay\",\r\n \"email\": \"lloyd@example.com\",\r\n \"audience\": \"https://mysite.com\",\r\n \"expires\": 1308859352261,\r\n \"issuer\": \"browserid.org\"\r\n }\r\n\r\nOr this, if not:\r\n\r\n {\r\n \"status\": \"failure\",\r\n \"reason\": \"no certificate provided\"\r\n }\r\n\r\nBrowserID's response will have already been parsed from JSON into a dict by the time it reaches your `user_loader` function.\r\n\r\n# Optional Configuration\r\n\r\nYou can set the URLs Flask-BrowserID uses for login and logout by setting the following in your application's configuration:\r\n\r\n* `BROWSERID_LOGIN_URL`: defaults to `/api/login`\r\n* `BROWSERID_LOGOUT_URL`: defaults to `/api/logout`\r\n\r\nSee [Flask Configuration Handling](http://flask.pocoo.org/docs/config/) for more on how to configure your application.\r\n\r\n# Testing\r\n\r\nRunning `python setup.py test` will run the extension's automated test suite, but some tests can only be run (presently) by manually starting up the server and clicking around. To do so, from the extension's root directory, run `python tests/__init__.py -i`. The `-i` flag tells the test suite to skip normal testing and instead run the testing application with a test template so you can click around.\r\n\r\n# Credits\r\n\r\nMany thanks to [Flask-Mongoengine](), who I based the structure of this extension on, and to [Flask-Login](), for generally being a pretty sweet extension.", "description_content_type": null, "docs_url": "https://pythonhosted.org/Flask-BrowserID/", "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/garbados/flask-browserid", "keywords": "", "license": "MIT", "maintainer": "Max Thayer", "maintainer_email": "garbados@gmail.com", "name": "Flask-BrowserID", "package_url": "https://pypi.org/project/Flask-BrowserID/", "platform": "any", "project_url": "https://pypi.org/project/Flask-BrowserID/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/garbados/flask-browserid" }, "release_url": "https://pypi.org/project/Flask-BrowserID/0.1.0/", "requires_dist": null, "requires_python": null, "summary": "Flask support for BrowserID authentication", "version": "0.1.0" }, "last_serial": 827756, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "d35e1acb231c2bbc040e4d85084f55f9", "sha256": "9e5d0f905f0451f00bc545a1193e239877a58350884c97ec1974d2db36c978d9" }, "downloads": -1, "filename": "Flask-BrowserID-0.0.1.tar.gz", "has_sig": false, "md5_digest": "d35e1acb231c2bbc040e4d85084f55f9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5788, "upload_time": "2012-07-04T00:26:28", "url": "https://files.pythonhosted.org/packages/1c/a9/480ab54037acc26759678b626e7038c435b7ec937e59249ddbaedf0d6b76/Flask-BrowserID-0.0.1.tar.gz" } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "820acbcf4c81aa26159cc5a32842e82f", "sha256": "1dec80c9de25e827f76d2e2f0338457e142d700cdd49cb156086898445269af6" }, "downloads": -1, "filename": "Flask-BrowserID-0.0.3.macosx-10.8-intel.exe", "has_sig": false, "md5_digest": "820acbcf4c81aa26159cc5a32842e82f", "packagetype": "bdist_wininst", "python_version": "any", "requires_python": null, "size": 71762, "upload_time": "2013-07-30T04:33:05", "url": "https://files.pythonhosted.org/packages/ad/a3/2d4f5b4cdc63fc9996aaad9442a81c38eda2727e8dd051ee0a8eaecc80db/Flask-BrowserID-0.0.3.macosx-10.8-intel.exe" }, { "comment_text": "", "digests": { "md5": "3724bdcd8bb24bd15d3ed2372bc540d5", "sha256": "83f90392c74ab13e3ba7bd320eb2706f4e1c508f913d47ee689ef5b679a09f1a" }, "downloads": -1, "filename": "Flask-BrowserID-0.0.3.tar.gz", "has_sig": false, "md5_digest": "3724bdcd8bb24bd15d3ed2372bc540d5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5890, "upload_time": "2013-07-30T04:33:04", "url": "https://files.pythonhosted.org/packages/89/66/efc84c2f236a16734a79d7c0c967e93bed9c686562abedd2b5dc49550730/Flask-BrowserID-0.0.3.tar.gz" } ], "0.0.4": [ { "comment_text": "", "digests": { "md5": "8e2eb570b3043c0ef4654e981ee7b54f", "sha256": "bad57067e70c90ea96242dd2ae2085f841f838de282d2a94c0ed968c1d057d00" }, "downloads": -1, "filename": "Flask-BrowserID-0.0.4.macosx-10.8-intel.exe", "has_sig": false, "md5_digest": "8e2eb570b3043c0ef4654e981ee7b54f", "packagetype": "bdist_wininst", "python_version": "any", "requires_python": null, "size": 71888, "upload_time": "2013-07-30T04:35:26", "url": "https://files.pythonhosted.org/packages/cb/b5/be0ced0961a3dc59f4ea0d12f744c7e94f2673b418c3569b033929d95925/Flask-BrowserID-0.0.4.macosx-10.8-intel.exe" }, { "comment_text": "", "digests": { "md5": "931cfcb3bcb57c4c4431281388c4b6e9", "sha256": "79a72ff110c3dcdfbe91977fb79ed7ceb4f290aa2100942603077d39c5801dbe" }, "downloads": -1, "filename": "Flask-BrowserID-0.0.4.tar.gz", "has_sig": false, "md5_digest": "931cfcb3bcb57c4c4431281388c4b6e9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5918, "upload_time": "2013-07-30T04:35:24", "url": "https://files.pythonhosted.org/packages/93/ae/6f330c73d54fdcc4190ced869ddaf02f7105fcd31c465e9e7caa79c88a4d/Flask-BrowserID-0.0.4.tar.gz" } ], "0.1.0": [] }, "urls": [] }