From b889d586f5463fce8080b4e065f4f68c334b7a92 Mon Sep 17 00:00:00 2001 From: Achintha Isuru Date: Fri, 5 Apr 2024 21:17:07 +0530 Subject: [PATCH] [fix] Fix passkey not working properly in the petcare application --- .../authenticator/passkey_data/ChallengeInfo.kt | 6 ++++-- .../authenticator/passkey_data/PasskeyChallenge.kt | 14 +++++++------- .../PublicKeyCredentialRequestOptions.kt | 11 +++++++---- 3 files changed, 18 insertions(+), 13 deletions(-) diff --git a/petcare-sample/b2c/mobile-app/petcare/app/src/main/java/com/wso2_sample/api_auth_sample/model/ui/activities/login/fragments/auth/auth_method/passkey/authenticator/passkey_data/ChallengeInfo.kt b/petcare-sample/b2c/mobile-app/petcare/app/src/main/java/com/wso2_sample/api_auth_sample/model/ui/activities/login/fragments/auth/auth_method/passkey/authenticator/passkey_data/ChallengeInfo.kt index 724dc51d5..20d40f38b 100644 --- a/petcare-sample/b2c/mobile-app/petcare/app/src/main/java/com/wso2_sample/api_auth_sample/model/ui/activities/login/fragments/auth/auth_method/passkey/authenticator/passkey_data/ChallengeInfo.kt +++ b/petcare-sample/b2c/mobile-app/petcare/app/src/main/java/com/wso2_sample/api_auth_sample/model/ui/activities/login/fragments/auth/auth_method/passkey/authenticator/passkey_data/ChallengeInfo.kt @@ -1,13 +1,15 @@ package com.wso2_sample.api_auth_sample.model.ui.activities.login.fragments.auth.auth_method.passkey.authenticator.passkey_data +import com.fasterxml.jackson.annotation.JsonIgnoreProperties import com.fasterxml.jackson.core.type.TypeReference import com.fasterxml.jackson.databind.JsonNode import com.wso2_sample.api_auth_sample.util.Util -data class ChallengeInfo ( +@JsonIgnoreProperties(ignoreUnknown = true) +data class ChallengeInfo( val requestId: String, val publicKeyCredentialRequestOptions: PublicKeyCredentialRequestOptions, - val request: Any + val request: Any? ) { companion object { fun getChallengeInfoFromChallengeString(challengeString: String): ChallengeInfo { diff --git a/petcare-sample/b2c/mobile-app/petcare/app/src/main/java/com/wso2_sample/api_auth_sample/model/ui/activities/login/fragments/auth/auth_method/passkey/authenticator/passkey_data/PasskeyChallenge.kt b/petcare-sample/b2c/mobile-app/petcare/app/src/main/java/com/wso2_sample/api_auth_sample/model/ui/activities/login/fragments/auth/auth_method/passkey/authenticator/passkey_data/PasskeyChallenge.kt index bcef98844..cda825677 100644 --- a/petcare-sample/b2c/mobile-app/petcare/app/src/main/java/com/wso2_sample/api_auth_sample/model/ui/activities/login/fragments/auth/auth_method/passkey/authenticator/passkey_data/PasskeyChallenge.kt +++ b/petcare-sample/b2c/mobile-app/petcare/app/src/main/java/com/wso2_sample/api_auth_sample/model/ui/activities/login/fragments/auth/auth_method/passkey/authenticator/passkey_data/PasskeyChallenge.kt @@ -1,15 +1,15 @@ package com.wso2_sample.api_auth_sample.model.ui.activities.login.fragments.auth.auth_method.passkey.authenticator.passkey_data -import com.fasterxml.jackson.core.type.TypeReference -import com.fasterxml.jackson.databind.JsonNode +import com.fasterxml.jackson.annotation.JsonIgnoreProperties import com.wso2_sample.api_auth_sample.util.Util +@JsonIgnoreProperties(ignoreUnknown = true) data class PasskeyChallenge( - val challenge: String, - val allowCredentials: List, - val timeout: Long, - val userVerification: String, - val rpId: String + val challenge: String?, + val allowCredentials: List?, + val timeout: Long?, + val userVerification: String?, + val rpId: String? ) { override fun toString(): String { return Util.getJsonString(this) diff --git a/petcare-sample/b2c/mobile-app/petcare/app/src/main/java/com/wso2_sample/api_auth_sample/model/ui/activities/login/fragments/auth/auth_method/passkey/authenticator/passkey_data/PublicKeyCredentialRequestOptions.kt b/petcare-sample/b2c/mobile-app/petcare/app/src/main/java/com/wso2_sample/api_auth_sample/model/ui/activities/login/fragments/auth/auth_method/passkey/authenticator/passkey_data/PublicKeyCredentialRequestOptions.kt index 7e31a1b7f..bdc6a02e4 100644 --- a/petcare-sample/b2c/mobile-app/petcare/app/src/main/java/com/wso2_sample/api_auth_sample/model/ui/activities/login/fragments/auth/auth_method/passkey/authenticator/passkey_data/PublicKeyCredentialRequestOptions.kt +++ b/petcare-sample/b2c/mobile-app/petcare/app/src/main/java/com/wso2_sample/api_auth_sample/model/ui/activities/login/fragments/auth/auth_method/passkey/authenticator/passkey_data/PublicKeyCredentialRequestOptions.kt @@ -1,7 +1,10 @@ package com.wso2_sample.api_auth_sample.model.ui.activities.login.fragments.auth.auth_method.passkey.authenticator.passkey_data -data class PublicKeyCredentialRequestOptions ( - val challenge: String, - val rpId: String, - val extensions: Any +import com.fasterxml.jackson.annotation.JsonIgnoreProperties + +@JsonIgnoreProperties(ignoreUnknown = true) +data class PublicKeyCredentialRequestOptions( + val challenge: String?, + val rpId: String?, + val extensions: Any? )