Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ fun JSONObject.parseTokenBinding() = when (TokenBindingStatus.fromString(getStri
fun JSONObject.parseAuthenticationExtensions(): AuthenticationExtensions {
val builder = AuthenticationExtensions.Builder()
if (has("fidoAppIdExtension")) builder.setFido2Extension(FidoAppIdExtension(getJSONObject("fidoAppIdExtension").getString("appId")))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (has("fidoAppIdExtension")) builder.setFido2Extension(FidoAppIdExtension(getJSONObject("fidoAppIdExtension").getString("appId")))
if (has("fidoAppIdExtension")) builder.setFido2Extension(FidoAppIdExtension(getJSONObject("fidoAppIdExtension").getString("appid")))

This one also needs to be fixed.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't find any doc regarding fidoAppIdExtension, do you have one?

Also, I think it may be worth catching issues here, because we don't check if fidoAppIdExtension object has a appid field - and we can't be sure there isn't any type error

Suggested change
if (has("fidoAppIdExtension")) builder.setFido2Extension(FidoAppIdExtension(getJSONObject("fidoAppIdExtension").getString("appId")))
if (has("fidoAppIdExtension")) runCatching {
builder.setFido2Extension(FidoAppIdExtension(getJSONObject("fidoAppIdExtension").getString("appid")))
}

Note that we can probably do a runCatching for the other appid field

if (has("appid")) builder.setFido2Extension(FidoAppIdExtension(getString("appId")))
if (has("appid")) builder.setFido2Extension(FidoAppIdExtension(getString("appid")))
// TODO: Add support for other extensions
return builder.build()
}
Expand Down