Skip to content

Commit d8bb07a

Browse files
committed
Rename configuration options for memorized idp and force_authn
from: mirror_saml_force_authn to: mirror_force_authn from: memorize_disco_idp to: memorize_idp from: use_memorized_disco_idp_when_force_authn to: use_memorized_idp_when_force_authn Signed-off-by: Ivan Kanakarakis <[email protected]>
1 parent 2f57b5b commit d8bb07a

File tree

5 files changed

+28
-28
lines changed

5 files changed

+28
-28
lines changed

doc/README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -329,40 +329,40 @@ By default when the SAML frontend receives a SAML authentication request
329329
with `ForceAuthn` set to `True`, this information is not mirrored in the SAML
330330
authentication request that is generated by the SAML backend towards the
331331
upstream identity provider. If the configuration option
332-
`mirror_saml_force_authn` is set to `True`, then the default behaviour changes
332+
`mirror_force_authn` is set to `True`, then the default behaviour changes
333333
and the SAML backend will set `ForceAuthn` to true when it proxies a SAML
334334
authentication request with `ForceAuthn` set to `True`.
335335

336336
The default behaviour is `False`.
337337

338338
```yaml
339339
config:
340-
mirror_saml_force_authn: True
340+
mirror_force_authn: True
341341
[...]
342342
```
343343

344344
##### Memorize the IdP selected through the discovery service
345345

346346
In the classic flow, the user is asked to select their home organization to
347-
authenticate to. The `memorize_disco_idp` configuration option controls whether
347+
authenticate to. The `memorize_idp` configuration option controls whether
348348
the user will have to always select a target provider when a discovery service
349349
is configured. If the parameter is set to `True` (and `ForceAuthn` is not set),
350350
the proxy will remember and reuse the selected target provider for the duration
351351
that the state cookie is valid. If `ForceAuthn` is set, then the
352-
`use_memorized_disco_idp_when_force_authn` configuration option can overide
352+
`use_memorized_idp_when_force_authn` configuration option can overide
353353
this property and still reuse the selected target provider.
354354

355355
The default behaviour is `False`.
356356

357357
```yaml
358358
config:
359-
memorize_disco_idp: True
359+
memorize_idp: True
360360
[...]
361361
```
362362

363363
##### Use the configured discovery service if ForceAuthn is set to true
364364

365-
The `use_memorized_disco_idp_when_force_authn` configuration option controls
365+
The `use_memorized_idp_when_force_authn` configuration option controls
366366
whether the user will skip the configured discovery service when the SP sends a
367367
SAML authentication request with `ForceAuthn` set to `True` but the proxy has
368368
memorized the user's previous selection.
@@ -371,8 +371,8 @@ The default behaviour is `False`.
371371

372372
```yaml
373373
config:
374-
memorize_disco_idp: True
375-
use_memorized_disco_idp_when_force_authn: True
374+
memorize_idp: True
375+
use_memorized_idp_when_force_authn: True
376376
[...]
377377
```
378378

example/plugins/backends/saml2_backend.yaml.example

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ name: Saml2
33
config:
44
idp_blacklist_file: /path/to/blacklist.json
55

6-
mirror_saml_force_authn: no
7-
memorize_disco_idp: no
8-
use_memorized_disco_idp_when_force_authn: no
6+
mirror_force_authn: no
7+
memorize_idp: no
8+
use_memorized_idp_when_force_authn: no
99

1010
sp_config:
1111
key_file: backend.key

src/satosa/backends/saml2.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,11 @@
3737

3838
def get_memorized_idp(context, config, force_authn):
3939
memorized_idp = (
40-
config.get(SAMLBackend.KEY_MEMORIZE_DISCO_IDP)
41-
and context.state.get(Context.KEY_MEMORIZED_DISCO_IDP)
40+
config.get(SAMLBackend.KEY_MEMORIZE_IDP)
41+
and context.state.get(Context.KEY_MEMORIZED_IDP)
4242
)
4343
use_when_force_authn = config.get(
44-
SAMLBackend.KEY_USE_MEMORIZED_DISCO_IDP_WHEN_FORCE_AUTHN
44+
SAMLBackend.KEY_USE_MEMORIZED_IDP_WHEN_FORCE_AUTHN
4545
)
4646
value = (not force_authn or use_when_force_authn) and memorized_idp
4747
return value
@@ -50,7 +50,7 @@ def get_memorized_idp(context, config, force_authn):
5050
# XXX check KEY_FORCE_AUTHN value type (boolean vs str)
5151
def get_force_authn(context, config, sp_config):
5252
value = (
53-
config.get(SAMLBackend.KEY_MIRROR_SAML_FORCE_AUTHN)
53+
config.get(SAMLBackend.KEY_MIRROR_FORCE_AUTHN)
5454
and (
5555
context.state.get(Context.KEY_FORCE_AUTHN)
5656
or context.get_decoration(Context.KEY_FORCE_AUTHN)
@@ -68,9 +68,9 @@ class SAMLBackend(BackendModule, SAMLBaseModule):
6868
KEY_SAML_DISCOVERY_SERVICE_URL = 'saml_discovery_service_url'
6969
KEY_SAML_DISCOVERY_SERVICE_POLICY = 'saml_discovery_service_policy'
7070
KEY_SP_CONFIG = 'sp_config'
71-
KEY_MIRROR_SAML_FORCE_AUTHN = 'mirror_saml_force_authn'
72-
KEY_MEMORIZE_DISCO_IDP = 'memorize_disco_idp'
73-
KEY_USE_MEMORIZED_DISCO_IDP_WHEN_FORCE_AUTHN = 'use_memorized_disco_idp_when_force_authn'
71+
KEY_MIRROR_FORCE_AUTHN = 'mirror_force_authn'
72+
KEY_MEMORIZE_IDP = 'memorize_idp'
73+
KEY_USE_MEMORIZED_IDP_WHEN_FORCE_AUTHN = 'use_memorized_idp_when_force_authn'
7474

7575
VALUE_ACR_COMPARISON_DEFAULT = 'exact'
7676

@@ -250,7 +250,7 @@ def authn_request(self, context, entity_id):
250250
authn_context = self.construct_requested_authn_context(entity_id)
251251
if authn_context:
252252
kwargs["requested_authn_context"] = authn_context
253-
if self.config.get(SAMLBackend.KEY_MIRROR_SAML_FORCE_AUTHN):
253+
if self.config.get(SAMLBackend.KEY_MIRROR_FORCE_AUTHN):
254254
kwargs["force_authn"] = get_force_authn(
255255
context, self.config, self.sp.config
256256
)
@@ -320,9 +320,9 @@ def authn_response(self, context, binding):
320320
raise SATOSAAuthenticationError(context.state, "State did not match relay state")
321321

322322
context.decorate(Context.KEY_BACKEND_METADATA_STORE, self.sp.metadata)
323-
if self.config.get(SAMLBackend.KEY_MEMORIZE_DISCO_IDP):
323+
if self.config.get(SAMLBackend.KEY_MEMORIZE_IDP):
324324
issuer = authn_response.response.issuer.text.strip()
325-
context.state[Context.KEY_MEMORIZED_DISCO_IDP] = issuer
325+
context.state[Context.KEY_MEMORIZED_IDP] = issuer
326326
context.state.pop(self.name, None)
327327
context.state.pop(Context.KEY_FORCE_AUTHN, None)
328328
return self.auth_callback_func(context, self._translate_response(authn_response, context.state))

src/satosa/context.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class Context(object):
1818
KEY_BACKEND_METADATA_STORE = 'metadata_store'
1919
KEY_TARGET_ENTITYID = 'target_entity_id'
2020
KEY_FORCE_AUTHN = 'force_authn'
21-
KEY_MEMORIZED_DISCO_IDP = 'memorized_disco_idp'
21+
KEY_MEMORIZED_IDP = 'memorized_idp'
2222

2323
def __init__(self):
2424
self._path = None

tests/satosa/backends/test_saml2.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -187,22 +187,22 @@ def test_use_of_disco_or_redirect_to_idp_when_using_mdq_and_forceauthn_is_not_se
187187
backend_conf = {
188188
SAMLBackend.KEY_SP_CONFIG: sp_conf,
189189
SAMLBackend.KEY_DISCO_SRV: DISCOSRV_URL,
190-
SAMLBackend.KEY_MEMORIZE_DISCO_IDP: True,
190+
SAMLBackend.KEY_MEMORIZE_IDP: True,
191191
}
192192
samlbackend = SAMLBackend(
193193
None, INTERNAL_ATTRIBUTES, backend_conf, "base_url", "saml_backend"
194194
)
195195
resp = samlbackend.start_auth(context, InternalData())
196196
self.assert_redirect_to_discovery_server(resp, sp_conf, DISCOSRV_URL)
197197

198-
context.state[Context.KEY_MEMORIZED_DISCO_IDP] = idp_conf["entityid"]
198+
context.state[Context.KEY_MEMORIZED_IDP] = idp_conf["entityid"]
199199
samlbackend = SAMLBackend(
200200
None, INTERNAL_ATTRIBUTES, backend_conf, "base_url", "saml_backend"
201201
)
202202
resp = samlbackend.start_auth(context, InternalData())
203203
self.assert_redirect_to_idp(resp, idp_conf)
204204

205-
backend_conf[SAMLBackend.KEY_MEMORIZE_DISCO_IDP] = False
205+
backend_conf[SAMLBackend.KEY_MEMORIZE_IDP] = False
206206
samlbackend = SAMLBackend(
207207
None, INTERNAL_ATTRIBUTES, backend_conf, "base_url", "saml_backend"
208208
)
@@ -216,12 +216,12 @@ def test_use_of_disco_or_redirect_to_idp_when_using_mdq_and_forceauthn_is_set(
216216
sp_conf["metadata"]["mdq"] = ["https://mdq.example.com"]
217217

218218
context.decorate(Context.KEY_FORCE_AUTHN, "true")
219-
context.state[Context.KEY_MEMORIZED_DISCO_IDP] = idp_conf["entityid"]
219+
context.state[Context.KEY_MEMORIZED_IDP] = idp_conf["entityid"]
220220

221221
backend_conf = {
222222
SAMLBackend.KEY_SP_CONFIG: sp_conf,
223223
SAMLBackend.KEY_DISCO_SRV: DISCOSRV_URL,
224-
SAMLBackend.KEY_MEMORIZE_DISCO_IDP: True,
224+
SAMLBackend.KEY_MEMORIZE_IDP: True,
225225
SAMLBackend.KEY_MIRROR_FORCE_AUTHN: True,
226226
}
227227
samlbackend = SAMLBackend(
@@ -230,7 +230,7 @@ def test_use_of_disco_or_redirect_to_idp_when_using_mdq_and_forceauthn_is_set(
230230
resp = samlbackend.start_auth(context, InternalData())
231231
self.assert_redirect_to_discovery_server(resp, sp_conf, DISCOSRV_URL)
232232

233-
backend_conf[SAMLBackend.KEY_USE_MEMORIZED_DISCO_IDP_WHEN_FORCE_AUTHN] = True
233+
backend_conf[SAMLBackend.KEY_USE_MEMORIZED_IDP_WHEN_FORCE_AUTHN] = True
234234
samlbackend = SAMLBackend(
235235
None, INTERNAL_ATTRIBUTES, backend_conf, "base_url", "saml_backend"
236236
)

0 commit comments

Comments
 (0)