{ "info": { "author": "Adam Kariv, Open Knowledge (International), Datopian", "author_email": "", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Environment :: Web Environment", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3.6", "Topic :: Internet :: WWW/HTTP :: Dynamic Content", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "# DataHQ auth service\n\n[![Build Status](https://travis-ci.org/datahq/auth.svg?branch=master)](https://travis-ci.org/datahq/auth)\n\nA generic OAuth2 authentication service and user permission manager.\n\n## Quick start\n\n### Clone the repo and install\n\n`make install`\n\n### Run tests\n\n`make test`\n\n### Run server\n\n`python server.py`\n\n## Env Vars\n- `PRIVATE_KEY` & `PUBLIC_KEY` an RSA key-pair in PEM format.\n See `tools/generate_key_pair.sh` for more info.\n- `GOOGLE_KEY` & `GOOGLE_SECRET`: OAuth credentials for authenticating with Google\n- `GITHUB_KEY` & `GITHUB_SECRET`: OAuth credentials for authenticating with Github\n- `DATABASE_URL`: A SQLAlchemy compatible database connection string (where user data is stored)\n- `EXTERNAL_ADDRESS`: The hostname where this service is located on\n- `ALLOWED_SERVICES`:\n Which permissions providers are available. A `;` delimited list of provider identifiers.\n Each provider identifier takes the form of `[alias:]provider`, where `provider` is the name of a Python module\n which exports a `get_permissions(service, userid)` function.\n- `INSTALLED_EXTENSIONS`:\n List of installed extensions. A `;` delimited list of `extension` - the name of a Python modules which exports one or all of these functions\n - `on_new_user(user_info)`\n - `on_user_login(user_info)`\n - `on_user_logout(user_info)`\n\n\n## API\n\n### Check an authentication token's validity\n`/auth/check`\n\n**Method:** `GET`\n\n**Query Parameters:**\n\n - `jwt` - authentication token\n - `next` - URL to redirect to when finished authentication\n\n**Returns:**\n\nIf authenticated:\n\n```json\n{\n \"authenticated\": true,\n \"profile\": {\n \"id\": \"\",\n \"name\": \"\",\n \"email\": \"\",\n \"avatar_url\": \"\",\n \"idhash\": \"\",\n \"username\": \"\" # If user has a username\n }\n}\n```\n\nIf not:\n\n```json\n{\n \"authenticated\": false,\n \"providers\": {\n \"google\": {\n \"url\": \"\"\n },\n \"github\": {\n \"url\": \"\"\n },\n }\n}\n```\n\nWhen the authentication flow is finished, the caller will be redirected to the `next` URL with an extra query parameter\n`jwt` which contains the authentication token. The caller should cache this token for further interactions with the API.\n\n### Get permission for a service\n`/auth/authorize`\n\n**Method:** `GET`\n\n**Query Parameters:**\n\n - `jwt` - user token (received from `/user/check`)\n - `service` - the relevant service (e.g. `storage-service`)\n\n**Returns:**\n\n```json\n{\n \"token\": \"\"\n \"userid\": \"\",\n \"permissions\": {\n \"permission-x\": true,\n \"permission-y\": false\n },\n \"service\": \"\"\n}\n```\n\n### Change the username\n`/auth/update`\n\n**Method:** `POST`\n\n**Query Parameters:**\n\n - `jwt` - authentication token (received from `/user/check`)\n - `username` - A new username for the user profile (this action is only allowed once)\n\n**Returns:**\n\n```json\n{\n \"success\": true,\n \"error\": \"\"\n}\n```\n\n__Note__: trying to update other user profile fields like `email` will fail silently and return\n\n```json\n{\n \"success\": true\n}\n```\n\n### Receive authorization public key\n`/auth/public-key`\n\n**Method:** `GET`\n\n**Returns:**\n\nThe service's public key in PEM format.\n\nCan be used by services to validate that the permission token is authentic.", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/datahq/auth", "keywords": "data", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "dhq-auth", "package_url": "https://pypi.org/project/dhq-auth/", "platform": "", "project_url": "https://pypi.org/project/dhq-auth/", "project_urls": { "Homepage": "https://github.com/datahq/auth" }, "release_url": "https://pypi.org/project/dhq-auth/0.1.3/", "requires_dist": null, "requires_python": "", "summary": "{{ DESCRIPTION }}", "version": "0.1.3" }, "last_serial": 4487008, "releases": { "0.1.1": [ { "comment_text": "", "digests": { "md5": "8755d08ec880542dfa81e30de94fbd30", "sha256": "c48f9cda80dcf869dd3cf8498915bdf6fb29bfa286c1adb2aafd4ade7a592807" }, "downloads": -1, "filename": "dhq-auth-0.1.1.tar.gz", "has_sig": false, "md5_digest": "8755d08ec880542dfa81e30de94fbd30", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 30725, "upload_time": "2018-11-04T06:51:43", "url": "https://files.pythonhosted.org/packages/da/fd/cfa2232fbad4e8ea0bf232a75b380687e092145f7d457d41335f59efe694/dhq-auth-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "9095fed38bb5fb127f4e1828be766f3d", "sha256": "aa7f95407a6997200c6059b6e90511d4c44bda21e023603a4de9e48943b32edd" }, "downloads": -1, "filename": "dhq-auth-0.1.2.tar.gz", "has_sig": false, "md5_digest": "9095fed38bb5fb127f4e1828be766f3d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9514, "upload_time": "2018-11-04T07:04:53", "url": "https://files.pythonhosted.org/packages/14/b2/dd8112ecd4f0abaff9ac36c3ea84052f2d6481a84f4964eca36f2eb3dd75/dhq-auth-0.1.2.tar.gz" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "f9becec1edaeb938fdb255d39f8fdabc", "sha256": "6750506ed9acd03bba7ff49a49ea59b8049106831012a3eb2909ab2357bf03d1" }, "downloads": -1, "filename": "dhq-auth-0.1.3.tar.gz", "has_sig": false, "md5_digest": "f9becec1edaeb938fdb255d39f8fdabc", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9578, "upload_time": "2018-11-14T21:07:13", "url": "https://files.pythonhosted.org/packages/4a/60/6ba5cd49de9a9a5926f6118678f3e0a0124f21fb0878156a8fa5e626a0f8/dhq-auth-0.1.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "f9becec1edaeb938fdb255d39f8fdabc", "sha256": "6750506ed9acd03bba7ff49a49ea59b8049106831012a3eb2909ab2357bf03d1" }, "downloads": -1, "filename": "dhq-auth-0.1.3.tar.gz", "has_sig": false, "md5_digest": "f9becec1edaeb938fdb255d39f8fdabc", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9578, "upload_time": "2018-11-14T21:07:13", "url": "https://files.pythonhosted.org/packages/4a/60/6ba5cd49de9a9a5926f6118678f3e0a0124f21fb0878156a8fa5e626a0f8/dhq-auth-0.1.3.tar.gz" } ] }