{ "info": { "author": "Chris Dickinson", "author_email": "chrisdickinson@urbanairship.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "Natural Language :: English", "Programming Language :: Python", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7" ], "description": "# Mithril\n\n````\n\n ,--. ,--. ,--. ,--.,--. \n,--,--,--.`--',-' '-.| ,---. ,--.--.`--'| | \n| |,--.'-. .-'| .-. || .--',--.| | \n| | | || | | | | | | || | | || | \n`--`--`--'`--' `--' `--' `--'`--' `--'`--' \n\n````\n\nA Django application providing decorators, middleware, and authentication\nbackends for IP whitelisting.\n\n> ### WARNING\n>\n> We grab IP address information from `request.META` -- which is potentially\n> spoofable. Make sure your gateway servers don't allow rewriting of the headers\n> you're targeting.\n\n## Getting Started\n\nMithril works by providing two new models -- `Whitelist` and `Range` -- that you\nmake a foreign key to from your objects. You define a `mithril.strategy.Strategy`\nsubclass to describe to mithril how you would like to obtain a `Whitelist` from\na request.\n\n````python\n# myapp/models.py\nfrom django.db import models\nfrom django.contrib.sites.models import Site\nfrom mithril.models import Whitelist\n\nclass SiteACL(models.Model):\n site = models.OneToOneField(Site)\n whitelist = models.ForeignKey(Whitelist, related_name='site_acl')\n\n# myapp/strategy.py\nfrom mithril.strategy import Strategy\nfrom django.conf import settings\nfrom myapp.models import SiteACL\n\nclass MyStrategy(Strategy): \n # a tuple of `method name` -> `lookup to apply`.\n # if the method does not exist, or returns None, it\n # continues to the next tuple.\n actions = (\n ('view_on_site', 'site_acl__pk')\n )\n\n def view_on_site(self, request, view, *view_args, **view_kwargs):\n try:\n site_acl = SiteACL.objects.get(site__pk=settings.SITE_ID)\n return site_acl.pk\n except SiteACL.DoesNotExist:\n pass \n\n# settings.py\n\nMITHRIL_STRATEGY = 'myapp.strategy.MyStrategy'\nMIDDLEWARE_CLASSES = list(MIDDLEWARE_CLASSES) + ['mithril.middleware.WhitelistMiddleware']\nINSTALLED_APPS = list(INSTALLED_APPS) + ['mithril']\n\n````", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://urbanairship.github.com/django-mithril/", "keywords": null, "license": "Copyright (c) 2012, Urban Airship\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n * Redistributions of source code must retain the above copyright\n notice, this list of conditions and the following disclaimer.\n * Redistributions in binary form must reproduce the above copyright\n notice, this list of conditions and the following disclaimer in the\n documentation and/or other materials provided with the distribution.\n * Neither the name of Django-Mithril nor the\n names of its contributors may be used to endorse or promote products\n derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL URBAN AIRSHIP BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.", "maintainer": null, "maintainer_email": null, "name": "django-mithril", "package_url": "https://pypi.org/project/django-mithril/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/django-mithril/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://urbanairship.github.com/django-mithril/" }, "release_url": "https://pypi.org/project/django-mithril/0.0.9/", "requires_dist": null, "requires_python": null, "summary": "IP Whitelisting for Django", "version": "0.0.9" }, "last_serial": 507958, "releases": { "0.0.9": [] }, "urls": [] }