AuthenticationService

interface AuthenticationService

An interface that contains the requisite fields and methods required for an authentication service.

Types

Link copied to clipboard
sealed class UpdateAttribute

A sealed class that contains multiple nested classes that model different user attributes that can be updated. For certain attributes, a password is required to update the value. For such attributes, a password field will be defined as the constructor param of the nested class.

Functions

Link copied to clipboard
abstract suspend fun createAccount(    username: String,     email: String,     password: String,     profilePhotoUri: Uri? = null): AuthenticationResult

Used to create a new user account with the provided username, email,password and an optional profilePhotoUri. An instance of AuthenticationResult will be returned to indicate whether an account was successfully created or not.

Link copied to clipboard
abstract suspend fun signIn(email: String, password: String): AuthenticationResult

Used to sign in a user with the provided email and password. An instance of AuthenticationResult will be returned to indicate a successful or failed sign-in attempt.

Link copied to clipboard
abstract fun signOut()

Used to sign out the current user.

Link copied to clipboard
abstract suspend fun updateAttributeForUser(user: ExamerUser, updateAttribute: AuthenticationService.UpdateAttribute): AuthenticationResult

Used to update an attribute of the specified user. The UpdateAttribute param of the function will be used to specify the attribute to update. An instance of AuthenticationResult will be returned to indicate whether the update was successful.

Properties

Link copied to clipboard
abstract val currentUser: LiveData<ExamerUser?>

The current user represents the user that is currently logged in. If it is null, it implies that there is no logged in user.

Inheritors

Link copied to clipboard