AuthService class
Authentication service exposing credentials of the authenticated session.
It contains all the required methods to do the authentication process and exposes credentials (a session and an user) of the authorized session.
- Inheritance
-
- Object
- GetLifeCycle
- DisposableInterface
- DisposableService
- AuthService
Constructors
- AuthService(AbstractAuthRepository _authRepository, CredentialsDriftProvider _credentialsProvider, AccountDriftProvider _accountProvider)
Properties
-
accounts
→ RxMap<
UserId, Rx< Credentials> > -
Credentials of the available accounts.
final
-
credentials
→ Rx<
Credentials?> -
Currently authorized session's Credentials.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- initialized → bool
-
Checks whether the controller has already been initialized.
no setterinherited
- isClosed → bool
-
Checks whether the controller has already been closed.
no setterinherited
-
onDelete
→ InternalFinalCallback<
void> -
Internal callback that starts the cycle of this controller.
finalinherited
-
onStart
→ InternalFinalCallback<
void> -
Called at the exact moment the widget is allocated in memory.
It uses an internal "callable" type, to avoid any @overrides in subclases.
This method should be internal and is required to define the
lifetime cycle of the subclass.
finalinherited
-
profiles
→ RxList<
MyUser> -
Returns the reactive list of known MyUsers.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
status
→ Rx<
RxStatus> -
Authorization status.
final
- userId → UserId?
-
Returns the currently authorized Credentials.userId.
no setter
Methods
-
$configureLifeCycle(
) → void -
inherited
-
createConfirmationCode(
{UserLogin? login, UserNum? num, UserEmail? email, UserPhone? phone, String? locale}) → Future< void> -
Generates and sends a new single-use ConfirmationCode for the MyUser
identified by the provided
login
,num
,email
and/orphone
. -
deleteSession(
{SessionId? id, UserPassword? password, bool force = false}) → Future< String?> -
Deletes Session with the provided
id
, if any, or otherwise Session of the active MyUser. -
init(
) → Future< String?> - Initializes this service.
-
isAuthorized(
[UserId? userId]) → bool -
Returns authorization status of the MyUser identified by the provided
UserId, if
userId
is non-null
, or of the active MyUser otherwise. -
logout(
[bool keepProfile = false]) → Future< String> - Deletes Session of the active MyUser and removes it from the list of available accounts.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onClose(
) → void -
Called before onDelete method. onClose might be used to
dispose resources used by the controller. Like closing events,
or streams before the controller is destroyed.
Or dispose objects that can potentially create some memory leaks,
like TextEditingControllers, AnimationControllers.
Might be useful as well to persist some data on disk.
override
-
onInit(
) → void -
Called immediately after the widget is allocated in memory.
You might use this to initialize something for the controller.
inherited
-
onReady(
) → void -
Called 1 frame after onInit(). It is the perfect place to enter
navigation events, like snackbar, dialogs, or a new route, or
async request.
inherited
-
refreshSession(
{UserId? userId}) → Future< void> -
Refreshes Credentials of the account with the provided
userId
or of the active one, ifuserId
is not provided. -
register(
{UserPassword? password, UserLogin? login, bool force = false}) → Future< void> - Creates a new MyUser having only UserId and UserNum fields, and creates a new Session for this MyUser (valid for 24 hours).
-
removeAccount(
UserId id) → Future< void> -
Deletes the MyUser identified by the provided
id
from the accounts and invalidates their Session. -
signIn(
{UserLogin? login, UserNum? num, UserEmail? email, UserPhone? phone, UserPassword? password, ConfirmationCode? code, bool unsafe = false, bool force = false}) → Future< void> -
Creates a new Session for the MyUser identified by the provided
num
/login
/email
/phone
(exactly one of four should be specified). -
signInWith(
Credentials credentials) → Future< void> -
Authorizes the current Session from the provided
credentials
. -
switchAccount(
UserId userId) → Future< bool> - Switches to the account with the provided UserId using the persisted Credentials.
-
toString(
) → String -
A string representation of this object.
inherited
-
updateUserPassword(
{required ConfirmationCode code, required UserPassword newPassword, UserLogin? login, UserNum? num, UserEmail? email, UserPhone? phone}) → Future< void> -
Resets password for a MyUser identified by the provided
num
/login
/email
/phone
(exactly one of fourth should be specified) and recovery ConfirmationCode. -
useChatDirectLink(
ChatDirectLinkSlug slug) → Future< Chat> - Uses the specified ChatDirectLink by the authenticated MyUser creating a new Chat-dialog or joining an existing Chat-group.
-
validateConfirmationCode(
{UserLogin? login, UserNum? num, UserEmail? email, UserPhone? phone, required ConfirmationCode code}) → Future< void> -
Validates the provided ConfirmationCode for the MyUser identified by the
provided
login
,num
,email
and/orphone
without using it. -
validateToken(
[Credentials? creds]) → Future< bool> - Validates the AccessToken of the provided Credentials.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited