AuthProvider class abstract

Authentication provider base class. Should know how to login and to get user details. Also stores an endpoint for making calls.

Implementers

Constructors

AuthProvider()
A constant constructor doing nothing. A provider should not have a state.
const

Properties

endpoint → String
Service endpoint to make requests.
no setter
hashCode → int
The hash code for this object.
no setterinherited
icon → MultiIcon?
An icon for the settings panel.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
title → String?
A title for the settings panel.
no setter

Methods

getApiKey(AuthToken token) → String
Returns a string to be supplied to API, if it needs one.
getHeaders(AuthToken token) → Map<String, String>
Returns headers to be added to an API request. Usually this adds a single "Authentication" header, but this depends on the API.
loadUserDetails(AuthToken token) → Future<UserDetails>
Makes a query to the server asking for user details. It gets called when opening the app, and after logging in.
login(BuildContext context) → Future<AuthToken?>
Open a login panel, perform the authentication, and receive a token. Should return null if the process was manually cancelled, or throw an AuthException if it failed.
logout(AuthToken token) → Future<void>
If needed, inform the server to log the user out.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
refreshToken(AuthToken token) → Future<AuthToken>
In case a token can become obsolete, implement this method.
testHeaders(Map<String, String>? headers, String? apiKey) → Future<bool>
Test the auth credentials. Should return true if they work.
tokenFromJson(Map<String, dynamic> data) → AuthToken
Unpack token retrieved from a secure storage.
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited