core / com.schibsted.account.session / User

User

class User : Parcelable

Represents a user and the actions a user can take. Actions are grouped under auth, agreements and profile,

Constructors

<init>

User(parcel: Parcel)User(token: UserToken, isPersistable: Boolean)

Represents a user and the actions a user can take. Actions are grouped under auth, agreements and profile,

Properties

agreements

val agreements: Agreements

auth

val auth: Auth

isPersistable

val isPersistable: Boolean

profile

val profile: Profile

userId

val userId: UserId

Functions

bind

fun bind(builder: Builder, urls: List<String>): Builder
fun bind(builder: Builder, urls: List<String>, allowNonHttps: Boolean, allowNonWhitelistedDomains: Boolean): Builder

Bind this session to an OkHttpClient. This will add an interceptor and override any authenticators already defined. Any requests not matching the host will be denied.

describeContents

fun describeContents(): Int

isActive

fun isActive(): Boolean

logout

fun logout(callback: ResultCallback<NoValue>?): Unit

Destroys the current session and removes it's access tokens from Schibsted account. Attempting to use this session afterwards will cause errors

persist

fun persist(context: Context): Unit

Manually persist a user session so that it can be resumed at a later point.

writeToParcel

fun writeToParcel(parcel: Parcel, flags: Int): Unit

Companion Object Properties

CREATOR

val CREATOR: Creator<User>

Companion Object Functions

fromSessionCode

fun fromSessionCode(code: String, redirectUri: String, isPersistable: Boolean, codeVerifier: String? = null, callback: ResultCallback<User>, scopes: Array<String>?): Unit

removeAllSession

fun removeAllSession(appContext: Context): Unit

Clears all stored user sessions

removeLastSession

fun removeLastSession(appContext: Context): Unit

Removes the last user's session, causing it not be be able to be resumed. If your purpose is to to log out the user, call User.logout instead.

removeSession

fun removeSession(appContext: Context, userId: String): Unit

Removes a user's session, causing it not be be able to be resumed. If your purpose is to to log out the user, call User.logout instead.

resumeLastSession

fun resumeLastSession(appContext: Context, callback: ResultCallback<User>): Unit

Resumes the last active user's session. This verifies that the user has accepted terms and that all required fields are provided. If this fails, onError will be called

resumeSession

fun resumeSession(appContext: Context, userId: String, callback: ResultCallback<User>): Unit

Resumes the last active user's session. This verifies that the user has accepted terms and that all required fields are provided. If this fails, onError will be called. If no session is found for the user id, onError will be called.