social-common / pragma.account / AccountPlugin /

AccountPlugin #

interface AccountPlugin

Plugin for account lifecycle events like creation, deletion and login

Functions #

NameSummary

onAccountCreate

abstract suspend fun onAccountCreate(idProviderAccount: IdProviderAccount): PragmaAccount

Called just before an account is created but after they have completed the initial authentication using the IdentityProvider. This can be used to block account creation by throwing AccountRpc.UnauthorizedApplicationError. This can also be used to set the user’s displayName, tags, and the groups they belong to.

onAccountCreated

abstract suspend fun onAccountCreated(pragmaAccount: PragmaAccount, idProviderAccount: IdProviderAccount)

Called after an account is created. Use this to make any desired updates to the user’s account.

onAccountDelete

abstract suspend fun onAccountDelete(pragmaAccount: PragmaAccount)

Called before an account is deleted. Use this to perform any actions just before a user is deleted.

onAccountDeleted

abstract suspend fun onAccountDeleted(pragmaAccount: PragmaAccount)

Called after an account is deleted Any updates to the PragmaAccount will not be persisted because the account has been removed.

onAccountLink

abstract suspend fun onAccountLink(pragmaAccount: PragmaAccount, idProviderAccount: IdProviderAccount)

Called before a user links their account with a new identity provider Use this to perform any actions before an account link is created Or throw an application error to prevent the link from being persisted

onAccountLogin

abstract suspend fun onAccountLogin(pragmaAccount: PragmaAccount, idProviderAccount: IdProviderAccount)

Called when an account is authenticated. Use this to make any desired updates to the user’s account. Or to block login by throwing AccountRpc.UnauthorizedApplicationError.

onAccountUnlink

abstract suspend fun onAccountUnlink(pragmaAccount: PragmaAccount, idProviderAccount: IdProviderAccount)

Called before a user unlinks their account from an existing identity provider Use this to perform any actions before an account unlink occurs Or throw an application error to prevent the unlink from occurring

onAccountUpdate

abstract suspend fun onAccountUpdate(pragmaAccount: PragmaAccount)

Called when an account is updated. Use this to make any desired updates to the user’s account.

updateDisplayName

abstract suspend fun updateDisplayName(requestedDisplayName: String, pragmaAccount: PragmaAccount)

Called when a user updates their own display name