Skip to content

Commit

Permalink
Merge pull request #700 from SUNET/lundberg_verified_phone_info
Browse files Browse the repository at this point in the history
Verified phone info in login flow
  • Loading branch information
helylle authored Sep 25, 2024
2 parents 43e48d4 + 3647a04 commit 2bea72f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 12 deletions.
1 change: 1 addition & 0 deletions src/eduid/webapp/idp/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class AuthnOptionsResponsePayload(EduidSchema):
username = fields.Bool(required=False)
usernamepassword = fields.Bool(required=False)
webauthn = fields.Bool(required=True)
verified_phone_number = fields.Bool(required=True)

class ServiceInfoResponsePayload(EduidSchema):
display_name = fields.Dict(keys=fields.Str(), values=fields.Str(), required=False)
Expand Down
12 changes: 0 additions & 12 deletions src/eduid/webapp/idp/tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,18 +338,6 @@ def _call_mfa(
result = MfaResult(payload=self.get_response_payload(response))
return result

@staticmethod
def _extract_form_inputs(res: str) -> dict[str, Any]:
inputs = {}
for line in res.split("\n"):
if "input" in line:
# YOLO
m = re.match(".*<input .* name=['\"](.+?)['\"].*value=['\"](.+?)['\"]", line)
if m:
name, value = m.groups()
inputs[name] = value.strip("'\"")
return inputs

def _extract_path_from_response(self, response: TestResponse) -> str:
return self._extract_path_from_info({"headers": response.headers})

Expand Down
6 changes: 6 additions & 0 deletions src/eduid/webapp/idp/views/next.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,8 @@ class AuthnOptions:
username: bool = True
# Can an unknown user log in using a webauthn credential? No, not at this time (might be doable).
webauthn: bool = False
# Temporary option for displaying info about removing phone numbers
verified_phone_number: bool = False

def to_dict(self) -> dict[str, Any]:
return asdict(self)
Expand Down Expand Up @@ -332,6 +334,10 @@ def _set_user_options(res: AuthnOptions, eppn: str) -> None:
current_app.logger.debug("User has a FIDO/Webauthn credential")
res.webauthn = True

if user.phone_numbers.verified:
current_app.logger.debug("User has a verified phone number")
res.verified_phone_number = True

if user.locked_identity.nin:
current_app.logger.debug("User has a locked NIN -> swedish eID is possible")
res.freja_eidplus = True
Expand Down

0 comments on commit 2bea72f

Please sign in to comment.