-
Notifications
You must be signed in to change notification settings - Fork 7
Update UserInfo.kt #13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,12 +1,21 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| package com.onelogin.oidc.userInfo | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import com.google.gson.Gson | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import com.google.gson.annotations.SerializedName | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| data class UserInfo( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| val sub: String, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| val email: String, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| val preferredUsername: String?, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @SerializedName("preferred_username") val preferredUsername: String?, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| val name: String?, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| val updatedAt: String?, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| val givenName: String?, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| val familyName: String?, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @SerializedName("updated_at") val updatedAt: String?, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @SerializedName("given_name") val givenName: String?, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @SerializedName("family_name") val familyName: String?, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| val groups: List<String>? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) : JSONConvertable | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| interface JSONConvertable { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fun toJSON(): String = Gson().toJson(this) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| inline fun <reified T: JSONConvertable> String.toObject(): T = Gson().fromJson(this, T::class.java) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+17
to
+21
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| interface JSONConvertable { | |
| fun toJSON(): String = Gson().toJson(this) | |
| } | |
| inline fun <reified T: JSONConvertable> String.toObject(): T = Gson().fromJson(this, T::class.java) | |
| private val gson = Gson() | |
| interface JSONConvertable { | |
| fun toJSON(): String = gson.toJson(this) | |
| } | |
| inline fun <reified T: JSONConvertable> String.toObject(): T = gson.fromJson(this, T::class.java) |
Copilot
AI
Jan 7, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Corrected spelling of 'Convertable' to 'Convertible'.
| ) : JSONConvertable | |
| interface JSONConvertable { | |
| fun toJSON(): String = Gson().toJson(this) | |
| } | |
| inline fun <reified T: JSONConvertable> String.toObject(): T = Gson().fromJson(this, T::class.java) | |
| ) : JSONConvertible | |
| interface JSONConvertible { | |
| fun toJSON(): String = Gson().toJson(this) | |
| } | |
| inline fun <reified T: JSONConvertible> String.toObject(): T = Gson().fromJson(this, T::class.java) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Gson import is used only in the newly added JSONConvertable interface, not in the UserInfo data class itself. Consider moving the JSONConvertable interface and its extension function to a separate utility file to keep concerns separated and avoid coupling the UserInfo data class with Gson implementation details.