Authorizer class abstract

Handles the generic OAuth flow by interfacing with native layer components and maintaining the state of the client.

Implemented types
Implementers

Constructors

Authorizer(Config config, {required StorageRepo storageRepo, SSLRepo? sslRepository, Client? baseClient, Duration? timeout, Uint8List? encryptionKey, bool? clearOnFreshInstall, required ConfigChangeStrategy configChangeStrategy})

Properties

authCodeGrant ↔ AuthorizationCodeGrant?
Internal representation of the OAuth flow.
getter/setter pair
authStates Stream<AuthState>
Returns the stream of authorization states.
no setteroverride
clearOnFreshInstall bool
Whether to clear previous Keychain items on a fresh install.
final
config Config
The configuration for this authorizer. This may be updated throughout the OAuth flow as new information is available.
final
configChangeStrategy ConfigChangeStrategy
The strategy to use when FTAuth is initialized with a new, conflicting configuration (client ID).
final
currentState AuthState
The current auth state.
no setteroverride
hashCode int
The hash code for this object.
no setterinherited
httpClient → Client
Handles internal HTTP requests.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
storageRepo StorageRepo
Stores client-sensitive information related to the OAuth flow. Must be persistent, so that state can be recovered on startup.
final

Methods

addState(AuthState state) → void
Adds the state to the stream and caches it.
authorize({String? language, String? countryCode}) Future<String>
Initiates the authorization code flow.
override
exchange(Map<String, String> parameters) Future<Client>
Performs the second part of the authorization code flow, exhanging the parameters retrieved via the WebView with the OAuth server for an access and refresh token.
override
getAuthorizationUrl({String? language, String? countryCode, Uri? redirectUri}) Future<String>
Returns the URL to direct the user to via a WebView.
handleExchange(Map<String, String> parameters) Future<AuthSignedIn>
init() Future<void>
Initializes the SDK.
override
isPinning(String host) bool
Returns true if the repository is currently pinning for host.
override
launchUrl(String url) Future<void>
Launches the given URL.
inherited
login({String? language, String? countryCode}) Future<void>
Performs the full two-step OAuth process.
inherited
logout({bool deinit = false}) Future<void>
Logs out the current user.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onFoundState({required String state, required String codeVerifier}) Future<AuthState>
Called when FTAuth initializes and a previous state and codeVerifier were found in storage. This generally means we are returning from a login or have stale info which should be cleared.
pinCert(Certificate certificate) → void
Creates a strict pinning to the given certificate for a particular host.
override
refreshAuthState() Future<void>
Pull the latest auth state from the keychain. If, for example, an app extension or another window changed it, we may not have the latest.
override
toString() String
A string representation of this object.
inherited

Operators

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