@@ -166,7 +166,7 @@ public class AuthenticationAPIClient @VisibleForTesting(otherwise = VisibleForTe
166166 * Example usage:
167167 *
168168 * ```
169- * client.signinWithPasskey("{authSession}", "{authResponse}","{realm}")
169+ * client.signinWithPasskey("{authSession}", "{authResponse}","{realm}","${organization}" )
170170 * .validateClaims() //mandatory
171171 * .setScope("{scope}")
172172 * .start(object: Callback<Credentials, AuthenticationException> {
@@ -178,17 +178,20 @@ public class AuthenticationAPIClient @VisibleForTesting(otherwise = VisibleForTe
178178 * @param authSession the auth session received from the server as part of the public key challenge request.
179179 * @param authResponse the [PublicKeyCredentials] authentication response
180180 * @param realm the connection to use. If excluded, the application will use the default connection configured in the tenant
181+ * @param organization id of the organization to be associated with the user while signing in
181182 * @return a request to configure and start that will yield [Credentials]
182183 */
183184 public fun signinWithPasskey (
184185 authSession : String ,
185186 authResponse : PublicKeyCredentials ,
186- realm : String? = null
187+ realm : String? = null,
188+ organization : String? = null,
187189 ): AuthenticationRequest {
188190 val params = ParameterBuilder .newBuilder().apply {
189191 setGrantType(ParameterBuilder .GRANT_TYPE_PASSKEY )
190192 set(AUTH_SESSION_KEY , authSession)
191193 realm?.let { setRealm(it) }
194+ organization?.let { set(ORGANIZATION_KEY , organization) }
192195 }.asDictionary()
193196
194197 return loginWithToken(params)
@@ -210,7 +213,7 @@ public class AuthenticationAPIClient @VisibleForTesting(otherwise = VisibleForTe
210213 * Example usage:
211214 *
212215 * ```
213- * client.signinWithPasskey("{authSession}", "{authResponse}","{realm}")
216+ * client.signinWithPasskey("{authSession}", "{authResponse}","{realm}","{organization}" )
214217 * .validateClaims() //mandatory
215218 * .setScope("{scope}")
216219 * .start(object: Callback<Credentials, AuthenticationException> {
@@ -222,18 +225,20 @@ public class AuthenticationAPIClient @VisibleForTesting(otherwise = VisibleForTe
222225 * @param authSession the auth session received from the server as part of the public key challenge request.
223226 * @param authResponse the public key credential authentication response in JSON string format that follows the standard webauthn json format
224227 * @param realm the connection to use. If excluded, the application will use the default connection configured in the tenant
228+ * @param organization id of the organization to be associated with the user while signing in
225229 * @return a request to configure and start that will yield [Credentials]
226230 */
227231 public fun signinWithPasskey (
228232 authSession : String ,
229233 authResponse : String ,
230- realm : String? = null
234+ realm : String? = null,
235+ organization : String? = null,
231236 ): AuthenticationRequest {
232237 val publicKeyCredentials = gson.fromJson(
233238 authResponse,
234239 PublicKeyCredentials ::class .java
235240 )
236- return signinWithPasskey(authSession, publicKeyCredentials, realm)
241+ return signinWithPasskey(authSession, publicKeyCredentials, realm, organization )
237242 }
238243
239244
@@ -247,7 +252,7 @@ public class AuthenticationAPIClient @VisibleForTesting(otherwise = VisibleForTe
247252 *
248253 *
249254 * ```
250- * client.signupWithPasskey("{userData}","{realm}")
255+ * client.signupWithPasskey("{userData}","{realm}","{organization}" )
251256 * .addParameter("scope","scope")
252257 * .start(object: Callback<PasskeyRegistration, AuthenticationException> {
253258 * override fun onSuccess(result: PasskeyRegistration) { }
@@ -257,11 +262,13 @@ public class AuthenticationAPIClient @VisibleForTesting(otherwise = VisibleForTe
257262 *
258263 * @param userData user information of the client
259264 * @param realm the connection to use. If excluded, the application will use the default connection configured in the tenant
265+ * @param organization id of the organization to be associated with the user while signing up
260266 * @return a request to configure and start that will yield [PasskeyRegistrationChallenge]
261267 */
262268 public fun signupWithPasskey (
263269 userData : UserData ,
264- realm : String? = null
270+ realm : String? = null,
271+ organization : String? = null
265272 ): Request <PasskeyRegistrationChallenge , AuthenticationException > {
266273 val user = gson.toJsonTree(userData)
267274 val url = auth0.getDomainUrl().toHttpUrl().newBuilder()
@@ -272,6 +279,7 @@ public class AuthenticationAPIClient @VisibleForTesting(otherwise = VisibleForTe
272279 val params = ParameterBuilder .newBuilder().apply {
273280 setClientId(clientId)
274281 realm?.let { setRealm(it) }
282+ organization?.let { set(ORGANIZATION_KEY , it) }
275283 }.asDictionary()
276284
277285 val passkeyRegistrationChallengeAdapter: JsonAdapter <PasskeyRegistrationChallenge > =
@@ -293,18 +301,20 @@ public class AuthenticationAPIClient @VisibleForTesting(otherwise = VisibleForTe
293301 * Example usage:
294302 *
295303 * ```
296- * client.passkeyChallenge("{realm}")
304+ * client.passkeyChallenge("{realm}", "{organization}" )
297305 * .start(object: Callback<PasskeyChallenge, AuthenticationException> {
298306 * override fun onSuccess(result: PasskeyChallenge) { }
299307 * override fun onFailure(error: AuthenticationException) { }
300308 * })
301309 * ```
302310 *
303311 * @param realm the connection to use. If excluded, the application will use the default connection configured in the tenant
312+ * @param organization id of the organization to be associated with the user while signing in
304313 * @return a request to configure and start that will yield [PasskeyChallenge]
305314 */
306315 public fun passkeyChallenge (
307- realm : String? = null
316+ realm : String? = null,
317+ organization : String? = null
308318 ): Request <PasskeyChallenge , AuthenticationException > {
309319 val url = auth0.getDomainUrl().toHttpUrl().newBuilder()
310320 .addPathSegment(PASSKEY_PATH )
@@ -314,6 +324,7 @@ public class AuthenticationAPIClient @VisibleForTesting(otherwise = VisibleForTe
314324 val parameters = ParameterBuilder .newBuilder().apply {
315325 setClientId(clientId)
316326 realm?.let { setRealm(it) }
327+ organization?.let { set(ORGANIZATION_KEY , organization) }
317328 }.asDictionary()
318329
319330 val passkeyChallengeAdapter: JsonAdapter <PasskeyChallenge > = GsonAdapter (
@@ -1054,7 +1065,7 @@ public class AuthenticationAPIClient @VisibleForTesting(otherwise = VisibleForTe
10541065 private const val RECOVERY_CODE_KEY = " recovery_code"
10551066 private const val SUBJECT_TOKEN_KEY = " subject_token"
10561067 private const val SUBJECT_TOKEN_TYPE_KEY = " subject_token_type"
1057- private const val REQUESTED_TOKEN_TYPE_KEY = " requested_token_type "
1068+ private const val ORGANIZATION_KEY = " organization "
10581069 private const val USER_METADATA_KEY = " user_metadata"
10591070 private const val AUTH_SESSION_KEY = " auth_session"
10601071 private const val AUTH_RESPONSE_KEY = " authn_response"
0 commit comments