Convert metadata as Java Object

Hello,

I want to manager app metadata and want to retrieve an entry converted to the java type used to create it.

To create the user, i used :

    val userTest = User("my_connection").apply {
        email = "testFUT@test.fr"
        name = "Test TEST FUT"
        appMetadata = mapOf("sites" to listOf(
            SiteRestResource(
                Site.SITE1
                "dsqdsq",
                "456456456"
            )
        ))
        setPassword("by4Nr9xUFnHjNE8".toCharArray())
    }

with SiteRestResource being :

data class SiteRestResource(
    val site: Site,
    val userId: String,
    val clientId: String
)

and Site :

enum class Site {
    SITE1,
    SITE2,
    SITE3
}

So i would be able to retrieve the metadata as a list of RestResource.

Something like val sites = user.appMetadata["sites"] as List<RestResource> ?

Is there a way to achieve this ?

  • SDK auth0-java
  • SDK Version 1.33.0
  • Kotlin 1.5.21

Thanks a lot in advance.