{ "info": { "author": "Abhishek Shrivastava", "author_email": "x.abhishek.flyhigh@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Framework :: Pyramid", "Intended Audience :: Developers", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Topic :: Internet :: WWW/HTTP :: WSGI" ], "description": "# SegAnnDB-login\n\nThis repository is a clone of original [pyramid_google_login](https://github.com/ludia/pyramid_google_login)\n\nIt contains modifications done in code to make it work with SegAnnDB\n\n**Approach**\n\n`pyramid_google_login` does not handle any kind of authentication policy by itself. It only helped in fetching the\nuser profile details from google. I made a workaround, now it sets a cookie in the response which is equivalent to the user_id\n(email)\n\nSome bugs were also fixed, turns out the original version did not work with the a latest version of pyramid anymore, so a \ncouple bugs were fixed as well.\n\n**On pypi -**\n\nThis package will be uploaded to pypi as well, under the same name.\n\nSetup: Application\n==================\n\nOnce `seganndb_login` is installed, you must use the `config.include`\nmechanism to include it into your Pyramid project's configuration. In your\nPyramid project's `__init__.py`:\n\n```python\n config = Configurator(.....)\n config.include('pyramid_google_login')\n```\n\nAlternately you can use the `pyramid.includes` configuration value in your\n`.ini` file:\n\n```ini\n [app:myapp]\n pyramid.includes = pyramid_google_login\n```\n\nSetup: settings\n===============\n\nMandatory settings:\n\n```ini\n security.google_login.client_id = xxxxxxx.apps.googleusercontent.com\n security.google_login.client_secret = xxxxxxxxxxxxxxxxxxxxxxxxx\n```\n\nOptional settings:\n\n```ini\n # List of Google scopes (`email` is automatically included)\n security.google_login.scopes = email\n\n # Set the access type to `offline` to get a refresh_token (default: online)\n security.google_login.access_type = online\n\n # Field used to extract the userid (generally `email` or `id`)\n security.google_login.user_id_field = email\n\n # Restrict authentication to a Google Apps domain\n security.google_login.hosted_domain = example.net\n\n # Redirect destination for logged in user.\n security.google_login.landing_url = /\n security.google_login.landing_route = my_frontend_route\n security.google_login.landing_route = mymodule:static/\n\n # Add a banner on the sign in page\n security.google_login.signin_banner = Welcome on Project Euler\n\n # Add an advice on the sign in page\n security.google_login.signin_advice = Ask Dilbert for access\n```\n\nSetup: Google project\n=====================\n\n- Create a project on https://console.developers.google.com\n- Create a OAuth Client ID\n\n + Choose a `Web Application` application type\n + Add all variants of your host in Javascript Origins\n\n * Secure and non secure url are differentiated\n * Optionally include your development host with\n `http://localhost:6543` rather than an `http://127.0.0.1:6543`\n (it would be refused)\n\nNotes:\n\n- No `Permissions` are needed by `pyramid_google_login` itself.\n- Client ID parameters are heavily cached. In development, re-creating a client\n id is often the best idea.\n\n\nGeneral Usage\n=============\n\nWhen a user must be authenticated by Google, he must be sent to the\n`auth_signin` route url. The helper method\n`pyramid_google_login.redirect_to_signin` redirect the user to the sign in\npage. This helper is handy to specify the next url and an optional message.\n\n```python\n\n @forbidden_view_config()\n def unauthenticated(context, request):\n return redirect_to_signin(request, url=request.path_qs)\n```\n\nOnce the user is authenticated, the `UserLoggedIn` pyramid event is\nbroadcasted. The application can perform subsequent validations, create the\nuser profile or update it.\n\nAfter that, the `pyramid.security.remember` helper is called.\n\nThen, the user will be redirected to an url specified by:\n\n- query parameter (signin page): `url`\n- setting: `security.google_login.landing_url`\n- fallback: `/`\n\nWhen a user must be logged out, he must be directed on the `auth_logout`\nroute url. Once logged out, he will be redirected back to the sign in page.\n\n\nOffline Usage\n=============\n\nIf you want to call the Google APIs on behalf of the user, you must store the\nOAuth2 tokens provided in the UserLoggedIn event. The `access_token` is\nusable for an `expires_in` period. Then the `refresh_token` must be used to\nrefresh the `access_token`. This `refresh_token` is valide until the user\nrevoke the application permissions.\n\nBy default, the only scope requested is `email` to identify the user. To call\nother Google APIs, you must add the related scopes as this:\n\n```ini\n [app:myapp]\n\n security.google_login.scopes =\n email\n https://www.googleapis.com/auth/admin.directory.user.readonly\n```\n\nEvents\n======\n\nUserLoggedIn\n------------\n\nThe user has logged in by Google.\n\nProperties:\n\n- userid\n- oauth2_token\n\n + access_token\n + expires_in\n + refresh_token\n\n- user_info\n\n + Google user_info properties...\n\nUserLoggedOut\n-------------\n\nThe user has logged out.\n\nProperties:\n\n- userid\n\nAll the related information to user_profiles can be found in file `views.py`\n\nRemembering User Authentication\n-------------------------------\n\nTo remember user authentication, we set a cookie in response. You will have to\nhandle client side login/logout by yourself. \n\nDevelopment\n===========\n\nRunning tests::\n\n $ pip install -r requirements-test.txt\n $ nosetests\n\nRunning pylama (linters)::\n\n $ pip install pylama\n ...\n $ pylama", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/abstatic/SegAnnDB-login", "keywords": "wsgi pylons pyramid auth authentication debug", "license": "BSD-derived (http://www.repoze.org/LICENSE.txt)", "maintainer": null, "maintainer_email": null, "name": "seganndb_login", "package_url": "https://pypi.org/project/seganndb_login/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/seganndb_login/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/abstatic/SegAnnDB-login" }, "release_url": "https://pypi.org/project/seganndb_login/1.0/", "requires_dist": null, "requires_python": null, "summary": "Pyramid login module for SegAnnDB login", "version": "1.0" }, "last_serial": 2284931, "releases": { "1.0": [ { "comment_text": "", "digests": { "md5": "6eeecbce1f478f16fc98b9016a300e63", "sha256": "395967804caf03942a758921e781161516a80da464d37ae111214951d505060b" }, "downloads": -1, "filename": "seganndb_login-1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "6eeecbce1f478f16fc98b9016a300e63", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 23059, "upload_time": "2016-08-16T20:28:34", "url": "https://files.pythonhosted.org/packages/19/d0/b7d0a5907766dd61ed924d0f73aab0473871bd952a024894759a05dab8e0/seganndb_login-1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "e74b36d8ba69483e66ce068af4238d4f", "sha256": "e59a04dfc3d05a117cabecbe81cbe8d475abce02b89e5b1ed33621f866ae13f4" }, "downloads": -1, "filename": "seganndb_login-1.0.tar.gz", "has_sig": false, "md5_digest": "e74b36d8ba69483e66ce068af4238d4f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17855, "upload_time": "2016-08-16T20:28:37", "url": "https://files.pythonhosted.org/packages/6c/6e/f62e398e1c19755c733b001bee53742810db1b9efa16e4145f01d6e61ae0/seganndb_login-1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "6eeecbce1f478f16fc98b9016a300e63", "sha256": "395967804caf03942a758921e781161516a80da464d37ae111214951d505060b" }, "downloads": -1, "filename": "seganndb_login-1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "6eeecbce1f478f16fc98b9016a300e63", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 23059, "upload_time": "2016-08-16T20:28:34", "url": "https://files.pythonhosted.org/packages/19/d0/b7d0a5907766dd61ed924d0f73aab0473871bd952a024894759a05dab8e0/seganndb_login-1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "e74b36d8ba69483e66ce068af4238d4f", "sha256": "e59a04dfc3d05a117cabecbe81cbe8d475abce02b89e5b1ed33621f866ae13f4" }, "downloads": -1, "filename": "seganndb_login-1.0.tar.gz", "has_sig": false, "md5_digest": "e74b36d8ba69483e66ce068af4238d4f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17855, "upload_time": "2016-08-16T20:28:37", "url": "https://files.pythonhosted.org/packages/6c/6e/f62e398e1c19755c733b001bee53742810db1b9efa16e4145f01d6e61ae0/seganndb_login-1.0.tar.gz" } ] }