{ "info": { "author": "UW-IT Identity and Access Management", "author_email": "help@uw.edu", "bugtrack_url": null, "classifiers": [], "description": "# uw-saml\n\n[![Build Status](https://travis-ci.org/UWIT-IAM/uw-saml-python.svg?branch=master)](https://travis-ci.org/UWIT-IAM/uw-saml-python)\n[![Coverage Status](https://coveralls.io/repos/github/UWIT-IAM/uw-saml-python/badge.svg?branch=master)](https://coveralls.io/github/UWIT-IAM/uw-saml-python?branch=master)\n\nA UW-specific adapter to the\n[python3-saml](https://github.com/onelogin/python3-saml) package. This package\nwas built to federate with other IdPs, but the default case is to use the UW\nIdentity Provider. It can be used against any framework. For a django-specific\npackage, also consider\n[uw-django-saml2](https://github.com/uw-it-aca/uw-django-saml2).\n\n## Installation\n\n```bash\npip install uw-saml[python3-saml]\n```\n\nThe extra `[python3-saml]` is because the SAML package can be cumbersome to\ninstall in a workstation environment, on account of needing the libxmlsec1-dev\nlibrary. Therefore, it's an optional requirement, causing a runtime error\ninstead of an install-time error. Alternatively, you can use a mock\ninterface by setting `uw_saml2.python3_saml.MOCK = True`.\n\n## Example login endpoint using flask\n\nIn this example you've gone to\n[SP Registry](https://iam-tools.u.washington.edu/spreg) and registered an\nEntity ID of https://samldemo.iamdev.s.uw.edu/saml, with an ACS endpoint of\nhttps://samldemo.iamdev.s.uw.edu/saml/login. GETs will return a\nredirect to the IdP for authentication, and POSTs will try to process a SAML\nResponse.\n\n```python\nfrom flask import request, session, redirect\nimport uw_saml2\n\n@app.route('/saml/login', methods=['GET', 'POST'])\ndef login():\n session.clear()\n args = {\n 'entity_id': 'https://samldemo.iamdev.s.uw.edu/saml',\n 'acs_url': 'https://samldemo.iamdev.s.uw.edu/saml/login'\n }\n if request.method == 'GET':\n args['return_to'] = request.args.get('url', None)\n return redirect(uw_saml2.login_redirect(**args))\n\n attributes = uw_saml2.process_response(request.form, **args)\n session['userid'] = attributes['uwnetid']\n session['groups'] = attributes.get('groups', [])\n\n relay_state = request.form.get('RelayState')\n if relay_state and relay_state.startswith('/'):\n return redirect(urljoin(request.url_root, request.form['RelayState']))\n\n return 'Welcome ' + session['userid']\n```\n\n## Considerations\n\n### Sessions\n\nGive some consideration to session lifetime. The session in this example lives as a\nsigned cookie. Ideally the cookie would expire at browser close, along with\nsome time limit appropriate for your application. An example again with flask\nfor a ten minute limit...\n\n```python\nfrom datetime import timedelta\n\napp.config.update(\n PERMANENT_SESSION_LIFETIME=timedelta(minutes=10)\n)\n```\n\n### Replay attack prevention\n\nBy default this package uses an in-memory cache to check for replay attacks.\nTo use a distributed cache such as redis or memcached you would inject a\ncache object into `uw_saml2.auth.CACHE`. Here's an example of how to do it...\n\n```python\nimport werkzeug.contrib.cache\nimport uw_saml2.auth\n\nuw_saml2.auth.CACHE = werkzeug.contrib.cache.RedisCache()\n```\n\nDjango's cache backend uses the same methods so that could be injected as well.", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/UWIT-IAM/uw-saml-python", "keywords": "", "license": "Apache License, Version 2.0", "maintainer": "", "maintainer_email": "", "name": "uw-saml", "package_url": "https://pypi.org/project/uw-saml/", "platform": "", "project_url": "https://pypi.org/project/uw-saml/", "project_urls": { "Homepage": "https://github.com/UWIT-IAM/uw-saml-python" }, "release_url": "https://pypi.org/project/uw-saml/1.0.7/", "requires_dist": null, "requires_python": "", "summary": "A UW-specific adapter to the python3-saml package.", "version": "1.0.7" }, "last_serial": 5718259, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "7ed697c203827ac00e23a883935b5144", "sha256": "b4c78a8ab288f6dfc6b308239d712ddf13f62f6b5ac97ea30560f2abb08042c9" }, "downloads": -1, "filename": "uw-saml-0.0.1.tar.gz", "has_sig": false, "md5_digest": "7ed697c203827ac00e23a883935b5144", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11500, "upload_time": "2019-02-04T19:52:15", "url": "https://files.pythonhosted.org/packages/f6/97/2b3d6c8a61a3e8323d6785199e0f68959d1ece3acf9baf7b2a233524e802/uw-saml-0.0.1.tar.gz" } ], "1.0.0": [ { "comment_text": "", "digests": { "md5": "09e067395fa7810452ceff387f88ba3c", "sha256": "7cd545f936ebe304a798ecfa85fc03878317bccb4dcbf95dbd964e38cfd13eff" }, "downloads": -1, "filename": "uw-saml-1.0.0.tar.gz", "has_sig": false, "md5_digest": "09e067395fa7810452ceff387f88ba3c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11591, "upload_time": "2019-02-04T20:17:11", "url": "https://files.pythonhosted.org/packages/39/83/01f25ab15f465b78488a1496b90f268017e9103b62e104079b0779ba16ab/uw-saml-1.0.0.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "2728c602e309d83e9f4d7825a2f1b2dc", "sha256": "effd58eea5cab29d9e500b74faab1bcf6207303456812af480ae619372e44007" }, "downloads": -1, "filename": "uw-saml-1.0.1.tar.gz", "has_sig": false, "md5_digest": "2728c602e309d83e9f4d7825a2f1b2dc", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12265, "upload_time": "2019-02-05T00:44:50", "url": "https://files.pythonhosted.org/packages/a2/60/4978476f7aa1afd28995f3a4d110c99278d23bc79c4ace7ffaf8a31b20e4/uw-saml-1.0.1.tar.gz" } ], "1.0.2": [ { "comment_text": "", "digests": { "md5": "2b4fb638954f83afd08d599372bbf303", "sha256": "929eedc58d1fbd24a3d7163e35952e0ab29db97c39cd41cfef43494d4a0db266" }, "downloads": -1, "filename": "uw-saml-1.0.2.tar.gz", "has_sig": false, "md5_digest": "2b4fb638954f83afd08d599372bbf303", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12393, "upload_time": "2019-02-05T23:46:25", "url": "https://files.pythonhosted.org/packages/53/f7/0ee1d1de4b24c2c59b8922224471ac45d36ec2404b2dc72ebd2e82c821f9/uw-saml-1.0.2.tar.gz" } ], "1.0.3": [ { "comment_text": "", "digests": { "md5": "9c06284bd8b287344bd1a5031ceaf822", "sha256": "2fcbd1232a1a986cc78e5a1c0c2095f2edb81812ef9b36ec9131bde653b717bb" }, "downloads": -1, "filename": "uw-saml-1.0.3.tar.gz", "has_sig": false, "md5_digest": "9c06284bd8b287344bd1a5031ceaf822", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12829, "upload_time": "2019-02-16T00:53:15", "url": "https://files.pythonhosted.org/packages/91/f4/bdffae2694bb2603897c38fc9df7d347e03d029b54e0ab7d4e732c36a38e/uw-saml-1.0.3.tar.gz" } ], "1.0.4": [ { "comment_text": "", "digests": { "md5": "d09b5dbe5d2e97fe7adad9a7a6a4e6d9", "sha256": "baef8e13de6742762d1eb9bf0a7dd92ac7d57bb7e8d585cc3706a390dbdcbfb2" }, "downloads": -1, "filename": "uw-saml-1.0.4.tar.gz", "has_sig": false, "md5_digest": "d09b5dbe5d2e97fe7adad9a7a6a4e6d9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12841, "upload_time": "2019-03-01T23:06:17", "url": "https://files.pythonhosted.org/packages/38/34/3117fd77a524dfec21c82a74122a8b2f12ef306d0d3412017db95f89e2fc/uw-saml-1.0.4.tar.gz" } ], "1.0.5": [ { "comment_text": "", "digests": { "md5": "13a3cdd0498158a51e47afadab319903", "sha256": "65abf7594743eb96f031441ad20f693ebcd0043e37e775d64e123e4c034fefd0" }, "downloads": -1, "filename": "uw-saml-1.0.5.tar.gz", "has_sig": false, "md5_digest": "13a3cdd0498158a51e47afadab319903", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12837, "upload_time": "2019-03-05T00:32:48", "url": "https://files.pythonhosted.org/packages/70/8c/45270ab06a7829c86e5dc98587fb0e56b0a008f688db43139b7855bb3617/uw-saml-1.0.5.tar.gz" } ], "1.0.6": [ { "comment_text": "", "digests": { "md5": "e83b879ddf906f16c695e9977b6c1565", "sha256": "80aa9eab9de7e11403c012af463a64d9d496b884e0269898146d9e86c73549f7" }, "downloads": -1, "filename": "uw-saml-1.0.6.tar.gz", "has_sig": false, "md5_digest": "e83b879ddf906f16c695e9977b6c1565", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13886, "upload_time": "2019-08-23T00:43:51", "url": "https://files.pythonhosted.org/packages/c6/d5/461ae15338b4547b7da827237d9886ae5ddfc276724cb7948d074dd3e66f/uw-saml-1.0.6.tar.gz" } ], "1.0.7": [ { "comment_text": "", "digests": { "md5": "4264c94af2453ffdf7782660251431c2", "sha256": "6ba23705f1e8d1913edce66a3c52b84534755343a4dd6563861587d94f74702c" }, "downloads": -1, "filename": "uw-saml-1.0.7.tar.gz", "has_sig": false, "md5_digest": "4264c94af2453ffdf7782660251431c2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13884, "upload_time": "2019-08-23T01:59:46", "url": "https://files.pythonhosted.org/packages/dd/47/ced66d42e8cfa76ec0876a8c51a1c844b57c955337f4ac85cc91d8da2be0/uw-saml-1.0.7.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "4264c94af2453ffdf7782660251431c2", "sha256": "6ba23705f1e8d1913edce66a3c52b84534755343a4dd6563861587d94f74702c" }, "downloads": -1, "filename": "uw-saml-1.0.7.tar.gz", "has_sig": false, "md5_digest": "4264c94af2453ffdf7782660251431c2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13884, "upload_time": "2019-08-23T01:59:46", "url": "https://files.pythonhosted.org/packages/dd/47/ced66d42e8cfa76ec0876a8c51a1c844b57c955337f4ac85cc91d8da2be0/uw-saml-1.0.7.tar.gz" } ] }