diff options
Diffstat (limited to 'src/main/kotlin/pl/treksoft/kvision/remote')
-rw-r--r-- | src/main/kotlin/pl/treksoft/kvision/remote/Jooby.kt | 87 |
1 files changed, 79 insertions, 8 deletions
diff --git a/src/main/kotlin/pl/treksoft/kvision/remote/Jooby.kt b/src/main/kotlin/pl/treksoft/kvision/remote/Jooby.kt index cd62487a..fcd6b0ab 100644 --- a/src/main/kotlin/pl/treksoft/kvision/remote/Jooby.kt +++ b/src/main/kotlin/pl/treksoft/kvision/remote/Jooby.kt @@ -22,6 +22,7 @@ package pl.treksoft.kvision.remote import kotlinx.serialization.Serializable +import kotlinx.serialization.Transient /** * A Jooby based server. @@ -41,12 +42,82 @@ actual interface Request @Serializable actual data class Profile( val id: String? = null, - val username: String? = null, + val attributes: MutableMap<String, String> = mutableMapOf(), + val authenticationAttributes: MutableMap<String, String> = mutableMapOf(), + val roles: MutableSet<String> = mutableSetOf(), + val permissions: MutableSet<String> = mutableSetOf(), val linkedId: String? = null, - val firstName: String? = null, - val familyName: String? = null, - val email: String? = null, - val displayName: String? = null, - val pictureUrl: String? = null, - val profileUrl: String? = null -) + val remembered: Boolean = false, + val clientName: String? = null +) { + @Transient + var username: String? + get() = attributes["username"] + set(value) { + if (value != null) { + attributes["username"] = value + } else { + attributes.remove("username") + } + } + @Transient + var firstName: String? + get() = attributes["first_name"] + set(value) { + if (value != null) { + attributes["first_name"] = value + } else { + attributes.remove("first_name") + } + } + @Transient + var familyName: String? + get() = attributes["family_name"] + set(value) { + if (value != null) { + attributes["family_name"] = value + } else { + attributes.remove("family_name") + } + } + @Transient + var displayName: String? + get() = attributes["display_name"] + set(value) { + if (value != null) { + attributes["display_name"] = value + } else { + attributes.remove("display_name") + } + } + @Transient + var email: String? + get() = attributes["email"] + set(value) { + if (value != null) { + attributes["email"] = value + } else { + attributes.remove("email") + } + } + @Transient + var pictureUrl: String? + get() = attributes["picture_url"] + set(value) { + if (value != null) { + attributes["picture_url"] = value + } else { + attributes.remove("picture_url") + } + } + @Transient + var profileUrl: String? + get() = attributes["profile_url"] + set(value) { + if (value != null) { + attributes["profile_url"] = value + } else { + attributes.remove("profile_url") + } + } +} |