{ "info": { "author": "marco-btree", "author_email": "marco@binarytree-software.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 2 - Pre-Alpha", "Environment :: Web Environment", "Framework :: Django", "Framework :: Django :: 2.0", "Framework :: Django :: 2.1", "Framework :: Django :: 2.2", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8" ], "description": "\nDjango Ariadne JWT\n==================\n\nSupport for JWT based authentication for use with the ariadne_ graphql library\nrunning inside a Django_ project. It is heavily inspired by django-graph-jwt_.\n\nInstallation\n------------\n::\n\n pip install django-ariadne-jwt\n\nHow to use\n----------\n\n``django-ariadne-jwt`` aims to be easy to install and use.\n\nFirst add ``JSONWebTokenBackend`` to your *AUTHENTICATION_BACKENDS*\n\n.. code:: python\n\n AUTHENTICATION_BACKENDS = [\n \"django_ariadne_jwt.backends.JSONWebTokenBackend\",\n # Any other authentication backends...\n \"django.contrib.auth.backends.ModelBackend\",\n ]\n\nThen add ``JSONWebTokenMiddleware`` to your view\n\n.. code:: python\n\n from django_ariadne_jwt.middleware import JSONWebTokenMiddleware\n\n urlpatterns = [\n # Your other paths...\n path(\n \"graphql/\",\n csrf_exempt(\n GraphQLView.as_view(\n schema=schema, middleware=[JSONWebTokenMiddleware()]\n )\n ),\n name=\"graphql\"\n )\n ]\n\n\nOr to your queries:\n\n.. code:: python\n\n ariadne.graphql_sync(\n schema,\n {\n \"query\": \"\"\"\n query {\n test\n }\n \"\"\"\n },\n middleware=[JSONWebTokenMiddleware()],\n )\n\n\nAnd then add the ``login_decorator`` to your resolvers before adding the field:\n\n.. code:: python\n\n from django_ariadne_jwt.decorators import login_required\n\n @query_type.field(\"test\")\n @login_required\n def resolve_test(*args):\n ...\n\n\nThis will prevent the field from resolving and ``ariadne`` will add an error to\nthe query result.\n\nFinally add the type definitions and resolvers to the executable schema\n\n.. code:: python\n\n from django_ariadne_jwt.resolvers import (\n auth_token_definition,\n auth_token_verification_definition,\n resolve_token_auth,\n resolve_refresh_token,\n resolve_verify_token,\n )\n\n type_definitions = \"\"\"\n ...\n\n type Mutation {\n ...\n tokenAuth(username: String!, password: String!): AuthToken!\n refreshToken(token: String!): AuthToken!\n verifyToken(token: String!): AuthTokenVerification!\n ...\n }\n \"\"\"\n\n auth_type_definitions = [\n auth_token_definition,\n auth_token_verification_definition,\n ]\n\n resolvers = [\n ...\n ]\n\n auth_resolvers = [\n resolve_token_auth,\n resolve_refresh_token,\n resolve_verify_token,\n ]\n\n schema = ariadne.make_executable_schema(\n [type_definitions] + auth_type_definitions, resolvers + auth_resolvers\n )\n\nOnce you get an auth token, set the HTTP Authorization header to:\n\n``Token ``\n\n\nHow to contribute\n-----------------\n\n``django-ariadne-jwt`` is at a very early stage. It is currently\nmissing documentation, better testing and a lot of configuration options. Pull\nrequests with any of these are greatly appreciated.\n\n\n\n``django-ariadne-jwt`` is missing feature X\n-------------------------------------------\n\nFeel free to open an issue or create a pull request with the implementation\n\n.. _ariadne: https://ariadnegraphql.org/\n.. _Django: https://www.djangoproject.com/\n.. _django-graph-jwt: https://github.com/flavors/django-graphql-jwt>\n.. _Python: http://python.org\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/binarytree-software/django-ariadne-jwt", "keywords": "", "license": "MIT", "maintainer": "marco-btree", "maintainer_email": "", "name": "django-ariadne-jwt", "package_url": "https://pypi.org/project/django-ariadne-jwt/", "platform": "", "project_url": "https://pypi.org/project/django-ariadne-jwt/", "project_urls": { "Homepage": "https://github.com/binarytree-software/django-ariadne-jwt", "Issues": "https://github.com/binarytree-software/django-ariadne-jwt/issues" }, "release_url": "https://pypi.org/project/django-ariadne-jwt/0.2.0/", "requires_dist": [ "ariadne (>=0.6.0)", "Django (>=2.0.0)", "PyJWT (>=1.5.0)" ], "requires_python": "", "summary": "JSON Web Token for Django Ariadne", "version": "0.2.0" }, "last_serial": 5865913, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "ad2b00af0209a1d5975d1b0c4663c765", "sha256": "05dc25001b28d8ce0edbc9eb36c3189f623677991e15ecfb4437b5ad0d4efd56" }, "downloads": -1, "filename": "django_ariadne_jwt-0.1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "ad2b00af0209a1d5975d1b0c4663c765", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 7118, "upload_time": "2019-09-20T02:09:03", "url": "https://files.pythonhosted.org/packages/3b/44/ce49538431e43261598fbab6c57497c829566db10292adfb4f377a42b937/django_ariadne_jwt-0.1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "e08ec01c4efa5f60f63371437ab1574c", "sha256": "0ad5c73c9dc89fac93b0b142cce104e49a4b419483b4642c6cf9ca1658158fb1" }, "downloads": -1, "filename": "django-ariadne-jwt-0.1.0.tar.gz", "has_sig": false, "md5_digest": "e08ec01c4efa5f60f63371437ab1574c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5171, "upload_time": "2019-09-20T02:09:05", "url": "https://files.pythonhosted.org/packages/89/cb/0c7f8d11640fa5e972aee8c92aaef9416314a3d741153df6c6b90e19f3c7/django-ariadne-jwt-0.1.0.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "1d8bd50d90b42038533d8f33ec827680", "sha256": "bb6fd931720eea8f846bd1dbabd0e054a81bca637137630975bc9addce840427" }, "downloads": -1, "filename": "django_ariadne_jwt-0.2.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "1d8bd50d90b42038533d8f33ec827680", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 8895, "upload_time": "2019-09-21T12:34:02", "url": "https://files.pythonhosted.org/packages/11/00/0dede1b8d3aea384415711b53ee8954759e7d7cd4bf6f07a081c86166eee/django_ariadne_jwt-0.2.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "d807a58ceae9eb127e3d5343a4e73354", "sha256": "9e6462803be25b878494196946b9036858487274093e1d94d8efcc9b016a278c" }, "downloads": -1, "filename": "django-ariadne-jwt-0.2.0.tar.gz", "has_sig": false, "md5_digest": "d807a58ceae9eb127e3d5343a4e73354", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6570, "upload_time": "2019-09-21T12:34:05", "url": "https://files.pythonhosted.org/packages/16/fa/6f36a28bb4b23c253263c0de600423a719ff233c15ca80ba5d15f0796f6a/django-ariadne-jwt-0.2.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "1d8bd50d90b42038533d8f33ec827680", "sha256": "bb6fd931720eea8f846bd1dbabd0e054a81bca637137630975bc9addce840427" }, "downloads": -1, "filename": "django_ariadne_jwt-0.2.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "1d8bd50d90b42038533d8f33ec827680", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 8895, "upload_time": "2019-09-21T12:34:02", "url": "https://files.pythonhosted.org/packages/11/00/0dede1b8d3aea384415711b53ee8954759e7d7cd4bf6f07a081c86166eee/django_ariadne_jwt-0.2.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "d807a58ceae9eb127e3d5343a4e73354", "sha256": "9e6462803be25b878494196946b9036858487274093e1d94d8efcc9b016a278c" }, "downloads": -1, "filename": "django-ariadne-jwt-0.2.0.tar.gz", "has_sig": false, "md5_digest": "d807a58ceae9eb127e3d5343a4e73354", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6570, "upload_time": "2019-09-21T12:34:05", "url": "https://files.pythonhosted.org/packages/16/fa/6f36a28bb4b23c253263c0de600423a719ff233c15ca80ba5d15f0796f6a/django-ariadne-jwt-0.2.0.tar.gz" } ] }