diff --git a/src/main/java/com/auth0/json/mgmt/users/authenticationmethods/AuthenticationMethod.java b/src/main/java/com/auth0/json/mgmt/users/authenticationmethods/AuthenticationMethod.java index 66aa37a8..8b17b8f4 100644 --- a/src/main/java/com/auth0/json/mgmt/users/authenticationmethods/AuthenticationMethod.java +++ b/src/main/java/com/auth0/json/mgmt/users/authenticationmethods/AuthenticationMethod.java @@ -40,6 +40,14 @@ public class AuthenticationMethod { private String relyingPartyIdentifier; @JsonProperty("authentication_methods") private List authenticationMethods; + @JsonProperty("credential_device_type") + private String credentialDeviceType; + @JsonProperty("credential_backed_up") + private Boolean credentialBackedUp; + @JsonProperty("identity_user_id") + private String identityUserId; + @JsonProperty("user_agent") + private String userAgent; /** * Create a new instance. @@ -243,4 +251,40 @@ public void setRelyingPartyIdentifier(String relyingPartyIdentifier) { public List getAuthenticationMethods() { return authenticationMethods; } + + /** + * Applies to passkeys only. + * + * @return The kind of device the credential is stored on as defined by backup eligibility. "single_device" credentials cannot be backed up and synced to another device, "multi_device" credentials can be backed up if enabled by the end-user. + */ + public String getCredentialDeviceType() { + return credentialDeviceType; + } + + /** + * Applies to passkeys only. + * + * @return Whether the credential was backed up. + */ + public Boolean getCredentialBackedUp() { + return credentialBackedUp; + } + + /** + * Applies to passkeys only. + * + * @return The ID of the user identity linked with the authentication method. + */ + public String getIdentityUserId() { + return identityUserId; + } + + /** + * Applies to passkeys only. + * + * @return The user-agent of the browser used to create the passkey. + */ + public String getUserAgent() { + return userAgent; + } } diff --git a/src/test/java/com/auth0/json/mgmt/users/authenticationmethods/AuthenticationMethodTest.java b/src/test/java/com/auth0/json/mgmt/users/authenticationmethods/AuthenticationMethodTest.java index 0622b34d..bbe8c9a8 100644 --- a/src/test/java/com/auth0/json/mgmt/users/authenticationmethods/AuthenticationMethodTest.java +++ b/src/test/java/com/auth0/json/mgmt/users/authenticationmethods/AuthenticationMethodTest.java @@ -30,7 +30,11 @@ public void shouldDeserialize() throws Exception { " \"totp_secret\":\"totp\",\n" + " \"preferred_authentication_method\":\"phone\",\n" + " \"relying_party_identifier\":\"abc\",\n" + - " \"authentication_methods\":[{\"id\": \"id\", \"type\": \"type\"}]\n" + + " \"authentication_methods\":[{\"id\": \"id\", \"type\": \"type\"}],\n" + + " \"credential_device_type\": \"single_device\",\n" + + " \"credential_backed_up\": true,\n" + + " \"identity_user_id\": \"identityId\",\n" + + " \"user_agent\": \"userAgent\"" + " }"; @@ -54,7 +58,10 @@ public void shouldDeserialize() throws Exception { assertThat(authenticationMethod.getAuthenticationMethods(), hasSize(1)); assertThat(authenticationMethod.getAuthenticationMethods().get(0).getId(), is("id")); assertThat(authenticationMethod.getAuthenticationMethods().get(0).getType(), is("type")); - + assertThat(authenticationMethod.getCredentialDeviceType(), is("single_device")); + assertThat(authenticationMethod.getCredentialBackedUp(), is(true)); + assertThat(authenticationMethod.getIdentityUserId(), is("identityId")); + assertThat(authenticationMethod.getUserAgent(), is("userAgent")); } @Test diff --git a/src/test/resources/mgmt/authenticator_method_list.json b/src/test/resources/mgmt/authenticator_method_list.json index 7956f4f2..119011a1 100644 --- a/src/test/resources/mgmt/authenticator_method_list.json +++ b/src/test/resources/mgmt/authenticator_method_list.json @@ -7,6 +7,10 @@ "created_at": "2023-02-01T18:44:46.483Z", "last_auth_at": "2023-02-07T20:29:33.547Z", "preferred_authentication_method": "sms", + "credential_device_type": "single_device", + "credential_backed_up": true, + "identity_user_id": "identityId", + "user_agent": "userAgent", "authentication_methods": [ { "id": "sms|id",