Skip to content

Commit 801bdb2

Browse files
Add support for ForceAuthn SAML request attribute (#357)
1 parent a9e503c commit 801bdb2

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

AUTHORS.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,5 @@ an issue.
6161
- [Michael V. Battista](https://github.com/mvbattista)
6262
- [William Abbott](https://github.com/wrabit)
6363
- [Henry Harutyunyan](https://github.com/henryh9n) (Revolut)
64-
- [Noppanut Ploywong](https://github.com/noppanut15)
64+
- [Noppanut Ploywong](https://github.com/noppanut15)
65+
- [Mohammed Almeshal](https://github.com/MohammedAlmeshal)

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,7 @@ python setup.py install
208208
'LOGOUT_REQUESTS_SIGNED': True, # Require each logout request to be signed
209209
'WANT_ASSERTIONS_SIGNED': True, # Require each assertion to be signed
210210
'WANT_RESPONSE_SIGNED': True, # Require response to be signed
211+
'FORCE_AUTHN': False, # Forces the user to re-authenticate with each authentication request
211212
'ACCEPTED_TIME_DIFF': None, # Accepted time difference between your server and the Identity Provider
212213
'ALLOWED_REDIRECT_HOSTS': ["https://myfrontendclient.com"], # Allowed hosts to redirect to using the ?next parameter
213214
'TOKEN_REQUIRED': True, # Whether or not to require the token parameter in the SAML assertion
@@ -278,6 +279,7 @@ Some of the following settings are related to how this module operates. The rest
278279
| **LOGOUT\_REQUESTS\_SIGNED** | Set this to `False` if your provider doesn't sign each logout request. | `bool` | `True` | |
279280
| **WANT\_ASSERTIONS\_SIGNED** | Set this to `False` if your provider doesn't sign each assertion. | `bool` | `True` | |
280281
| **WANT\_RESPONSE\_SIGNED** | Set this to `False` if you don't want your provider to sign the response. | `bool` | `True` | |
282+
| **FORCE\_AUTHN** | SAML2 request attribute that forces the user to re-authenticate with the Identity Provider (IdP), even if they already have an active session. | `bool` | `False` | |
281283
| **ACCEPTED\_TIME\_DIFF** | Sets the [accepted time diff](https://pysaml2.readthedocs.io/en/latest/howto/config.html#accepted-time-diff) in seconds | `int` or `None` | `None` | |
282284
| **ALLOWED\_REDIRECT\_HOSTS** | Allowed hosts to redirect to using the `?next=` parameter | `list` | `[]` | `['https://app.example.com', 'https://api.exmaple.com']` |
283285
| **DISABLE\_EXCEPTION\_HANDLER** | Set this to `True` if you want to disable the exception handler. Make sure to handle the `SAMLAuthError`s and other exceptions. | `bool` | `False` | |

django_saml2_auth/saml.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,7 @@ def get_saml_client(
238238
"want_response_signed": dictor(
239239
saml2_auth_settings, "WANT_RESPONSE_SIGNED", default=True
240240
),
241+
"force_authn": dictor(saml2_auth_settings, "FORCE_AUTHN", default=False),
241242
},
242243
},
243244
}

0 commit comments

Comments
 (0)