|
1 |
| -# Django SAML2 Authentication Made Easy |
| 1 | +# Django SAML2 Authentication |
2 | 2 |
|
3 |
| -- Original Author |
4 |
| - Fang Li |
| 3 | +This plugin provides a simple way to integrate SAML2 Authentication into your Django-powered app. SAML SSO is a standard, so practically any SAML2 based SSO identity provider is supported. |
5 | 4 |
|
6 |
| -- Maintainer |
7 |
| - Mostafa Moradian |
| 5 | +This plugin supports both identity provider and service provider-initiated SSO: |
8 | 6 |
|
9 |
| -- Version support matrix |
| 7 | +- For IdP-initiated SSO, the user should sign in to their identity provider platform, e.g., Okta, and click on the application that authorizes and redirects the user to the service provider, that is your platform. |
| 8 | +- For SP-initiated SSO, the user should first exist on your platform, either by signing in via the first method (IdP-initiated SSO) or any other custom solution. It can be configured to be redirected to the correct application on the identity provider platform. |
| 9 | + |
| 10 | +For IdP-initiated SSO, the user will be created if it doesn't exist. Still, for SP-initiated SSO, the user should exist in your platform for the code to detect and redirect them to the correct application on the identity provider platform. |
| 11 | + |
| 12 | +- [Django SAML2 Authentication](#django-saml2-authentication) |
| 13 | + - [Project Information](#project-information) |
| 14 | + - [Donate](#donate) |
| 15 | + - [Installation](#installation) |
| 16 | + - [How to use?](#how-to-use) |
| 17 | + - [Module Settings](#module-settings) |
| 18 | + - [JWT Signing Algorithm and Settings](#jwt-signing-algorithm-and-settings) |
| 19 | + - [Custom token triggers](#custom-token-triggers) |
| 20 | + - [Customize Error Messages](#customize-error-messages) |
| 21 | + - [For Okta Users](#for-okta-users) |
| 22 | + |
| 23 | +## Project Information |
| 24 | + |
| 25 | +- Original Author: Fang Li ([@fangli](https://github.com/fangli)) |
| 26 | +- Maintainer: Mostafa Moradian ([@mostafa](https://github.com/mostafa)) |
| 27 | +- Version support matrix: |
10 | 28 | | **Python** | **Django** | **django-saml2-auth** |
|
11 | 29 | | --------------------------- | ---------- | --------------------- |
|
12 | 30 | | 3.7.x, 3.8.x, 3.9.x, 3.10.x | 2.2.x | >=3.4.0 |
|
13 | 31 | | 3.7.x, 3.8.x, 3.9.x, 3.10.x | 3.2.x | >=3.4.0 |
|
14 | 32 | | 3.8.x, 3.9.x, 3.10.x | 4.0.x | >=3.4.0 |
|
15 | 33 |
|
16 |
| -This project aims to provide a simple way to integrate SAML2 Authentication into your Django-powered app. Try it now, and get rid of the complicated configuration of SAML. |
17 |
| - |
18 |
| -Any SAML2 based SSO (Single Sign-On) identity provider (IdP) with dynamic metadata configuration is supported by this Django plugin, for example Okta. The library also supports service provider-initiated SSO. |
| 34 | +- Release log is available [here](RELEASE-LOG.md). |
19 | 35 |
|
20 |
| -## When you raise an issue or PR |
21 |
| - |
22 |
| -Please note this library is mission-critical and supports almost all django versions since 2.2.x. We need to be extremely careful when merging any changes. |
23 |
| - |
24 |
| -The support for new versions of django are welcome and I'll make best effort to make it latest django compatible. |
| 36 | +- For contribution, read [contributing guide](CONTRIBUTING.md). |
25 | 37 |
|
26 | 38 | ## Donate
|
27 | 39 |
|
28 |
| -Please give us a shiny \! and help spread the word. |
| 40 | +Please give us a shiny  and help spread the word. |
29 | 41 |
|
30 |
| -## Install |
| 42 | +## Installation |
31 | 43 |
|
32 | 44 | You can install this plugin via `pip`. Make sure you update `pip` to be able to install from git:
|
33 | 45 |
|
@@ -56,15 +68,6 @@ or from source:
|
56 | 68 |
|
57 | 69 | [Windows binaries](https://www.zlatkovic.com/projects/libxml/index.html) are also available.
|
58 | 70 |
|
59 |
| -## What does this plugin do? |
60 |
| - |
61 |
| -This plugin can act as a SAML authentication system for Django that supports IdP and SP-initiated SSO. |
62 |
| - |
63 |
| -- For IdP-initiated SSO, the user should log in to their IdP platform (e.g. Okta), and click on the application that authorizes and redirects the user to the SP (your platform). |
64 |
| -- For SP-initiated SSO, the user should first exist on your platform (either log in using method 1 or else) and then it can be configured to be redirected to the correct application on the IdP platform. |
65 |
| - |
66 |
| -For IdP-initiated SSO, the user will be created if it doesn't exist, but for SP-initiated SSO, the user should exist in your platform for the code to detect and redirect them to the correct application on the IdP platform. |
67 |
| - |
68 | 71 | ## How to use?
|
69 | 72 |
|
70 | 73 | 1. Once you have the library installed or in your `requirements.txt`, import the views module in your root `urls.py`:
|
@@ -161,7 +164,8 @@ For IdP-initiated SSO, the user will be created if it doesn't exist, but for SP-
|
161 | 164 |
|
162 | 165 | 5. In your SAML2 SSO identity provider, set the Single-sign-on URL and Audience URI (SP Entity ID) to <http://your-domain/saml2_auth/acs/>
|
163 | 166 |
|
164 |
| -### Explanation |
| 167 | +## Module Settings |
| 168 | + |
165 | 169 | | **Field name** | **Description** | **Data type(s)** | **Default value(s)** | **Example** |
|
166 | 170 | | ------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------- | ---------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------- |
|
167 | 171 | | **METADATA\_AUTO\_CONF\_URL** | Auto SAML2 metadata configuration URL | `str` | `None` | `https://ORG.okta.com/app/APP-ID/sso/saml/metadata` |
|
@@ -262,7 +266,7 @@ def get_custom_token_query(refresh):
|
262 | 266 |
|
263 | 267 | ```
|
264 | 268 |
|
265 |
| -## Customize |
| 269 | +## Customize Error Messages |
266 | 270 |
|
267 | 271 | The default permission `denied`, `error` and user `welcome` page can be overridden.
|
268 | 272 |
|
@@ -293,50 +297,3 @@ I created this plugin originally for Okta. The `METADATA_AUTO_CONF_URL` needed i
|
293 | 297 | The `Identity Provider metadata` link is the `METADATA_AUTO_CONF_URL`.
|
294 | 298 |
|
295 | 299 | More information can be found in the [Okta Developer Documentation](https://developer.okta.com/docs/guides/saml-application-setup/overview/).
|
296 |
| - |
297 |
| -## How to Contribute |
298 |
| - |
299 |
| -1. Check for open issues or open a fresh issue to start a discussion around a feature idea or a bug. |
300 |
| -2. Fork [the repository](http://github.com/loadimpact/django-saml2-auth) on GitHub to start making your changes to the **master** branch (or branch off of it). |
301 |
| -3. Write a test which shows that the bug was fixed or that the feature works as expected. |
302 |
| -4. Send a pull request and bug the maintainer until it gets merged and published. :) Make sure to add yourself to [AUTHORS](https://github.com/grafana/django-saml2-auth/blob/master/AUTHORS.md). |
303 |
| - |
304 |
| -## Release Log |
305 |
| - |
306 |
| -3.4.0: Add support for Django 3.2 and 4.0 and remove support for older Python and Django versions |
307 |
| - |
308 |
| -3.3.0: Add support for PKI in JWT |
309 |
| - |
310 |
| -3.2.0: Update dependencies (#22) |
311 |
| - |
312 |
| -3.1.0: Make `token` field optional in the attribute statement by introducing `REQUIRE_TOKEN` settings (default: `True`) |
313 |
| - |
314 |
| -3.0.1: Minor fixes |
315 |
| - |
316 |
| -3.0.0: Extensive refactoring of the library (check the commit logs) - incompatible with previous versions |
317 |
| - |
318 |
| -2.3.0: Merge of PRs plus bugfixes and (manual) testing |
319 |
| - |
320 |
| -2.2.1: Fixed is\_safe\_url parameters issue for django 2.1 |
321 |
| - |
322 |
| -2.2.0: ADFS SAML compatibility and fixed some issue for Django2.0 |
323 |
| - |
324 |
| -2.1.2: Merged \#35 |
325 |
| - |
326 |
| -2.1.1: Added ASSERTION\_URL in settings. |
327 |
| - |
328 |
| -2.1.0: Add DEFAULT\_NEXT\_URL. Issue \#19. |
329 |
| - |
330 |
| -2.0.4: Fixed compatibility with Windows. |
331 |
| - |
332 |
| -2.0.3: Fixed a vulnerabilities in the login flow, thanks qwrrty. |
333 |
| - |
334 |
| -2.0.1: Add support for Django 1.10 |
335 |
| - |
336 |
| -1.1.4: Fixed urllib bug |
337 |
| - |
338 |
| -1.1.2: Added support for Python 2.7/3.x |
339 |
| - |
340 |
| -1.1.0: Added support for Django 1.6/1.7/1.8/1.9 |
341 |
| - |
342 |
| -1.0.4: Fixed English grammar mistakes |
0 commit comments