Skip to content

Commit

Permalink
all saml_sp_response needs authn_options
Browse files Browse the repository at this point in the history
use parameter names to clarify None usage
  • Loading branch information
johanlundberg committed Oct 7, 2024
1 parent 68d9471 commit c50359b
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/eduid/webapp/idp/views/next.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ def next_view(ticket: LoginContext, sso_session: SSOSession | None) -> FluxData:
if _next.message == IdPMsg.aborted:
if isinstance(ticket, LoginContextSAML):
saml_params = cancel_saml_request(ticket, current_app.conf)
return create_saml_sp_response(saml_params=saml_params)
authn_options = _get_authn_options(ticket=ticket, sso_session=sso_session, eppn=None)
return create_saml_sp_response(saml_params=saml_params, authn_options=authn_options)
elif isinstance(ticket, LoginContextOtherDevice):
state = ticket.other_device_req
if state.state in [OtherDeviceState.NEW, OtherDeviceState.IN_PROGRESS, OtherDeviceState.AUTHENTICATED]:
Expand Down Expand Up @@ -78,7 +79,8 @@ def next_view(ticket: LoginContext, sso_session: SSOSession | None) -> FluxData:
if _next.message == IdPMsg.assurance_failure:
if isinstance(ticket, LoginContextSAML):
saml_params = authn_context_class_not_supported(ticket, current_app.conf)
return create_saml_sp_response(saml_params=saml_params)
authn_options = _get_authn_options(ticket=ticket, sso_session=sso_session, eppn=None)
return create_saml_sp_response(saml_params=saml_params, authn_options=authn_options)
current_app.logger.error(f"Don't know how to send error response for request {ticket}")
return error_response(message=IdPMsg.general_failure)

Expand All @@ -100,7 +102,7 @@ def next_view(ticket: LoginContext, sso_session: SSOSession | None) -> FluxData:
_payload = {
"action": IdPAction.OTHER_DEVICE.value,
"target": url_for("other_device.use_other_1", _external=True),
"authn_options": _get_authn_options(ticket, sso_session, required_user.eppn),
"authn_options": _get_authn_options(ticket=ticket, sso_session=sso_session, eppn=required_user.eppn),
"service_info": _get_service_info(ticket),
}

Expand All @@ -113,7 +115,7 @@ def next_view(ticket: LoginContext, sso_session: SSOSession | None) -> FluxData:
_payload = {
"action": IdPAction.PWAUTH.value,
"target": url_for("pw_auth.pw_auth", _external=True),
"authn_options": _get_authn_options(ticket, sso_session, required_user.eppn),
"authn_options": _get_authn_options(ticket=ticket, sso_session=sso_session, eppn=required_user.eppn),
"service_info": _get_service_info(ticket),
}

Expand All @@ -128,7 +130,7 @@ def next_view(ticket: LoginContext, sso_session: SSOSession | None) -> FluxData:
payload={
"action": IdPAction.MFA.value,
"target": url_for("mfa_auth.mfa_auth", _external=True),
"authn_options": _get_authn_options(ticket, sso_session, required_user.eppn),
"authn_options": _get_authn_options(ticket=ticket, sso_session=sso_session, eppn=required_user.eppn),
"service_info": _get_service_info(ticket),
},
)
Expand All @@ -139,7 +141,7 @@ def next_view(ticket: LoginContext, sso_session: SSOSession | None) -> FluxData:
payload={
"action": IdPAction.TOU.value,
"target": url_for("tou.tou", _external=True),
"authn_options": _get_authn_options(ticket, sso_session, required_user.eppn),
"authn_options": _get_authn_options(ticket=ticket, sso_session=sso_session, eppn=required_user.eppn),
},
)

Expand Down Expand Up @@ -186,7 +188,7 @@ def next_view(ticket: LoginContext, sso_session: SSOSession | None) -> FluxData:

if isinstance(ticket, LoginContextSAML):
saml_params = sso.get_response_params(_next.authn_info, ticket, user)
authn_options = _get_authn_options(ticket, sso_session, required_user.eppn)
authn_options = _get_authn_options(ticket=ticket, sso_session=sso_session, eppn=required_user.eppn)
return create_saml_sp_response(saml_params=saml_params, authn_options=authn_options)
elif isinstance(ticket, LoginContextOtherDevice):
if not ticket.is_other_device_2:
Expand Down

0 comments on commit c50359b

Please sign in to comment.