ManagedAuthDelegate<T extends ManagedAuthResourceOwner> class
Null safety
AuthServerDelegate implementation for an AuthServer using ManagedObjects.
An instance of this class manages storage and retrieval of OAuth 2.0 tokens, clients and resource owners using the ManagedObjects declared in this library.
The type argument must be the application-specific resource owner that implements ManagedAuthResourceOwner.
Provide an instance of this type to an AuthServer at startup. For example, if the application has a type named User
that fulfills
ManagedAuthResourceOwner,
var context = ManagedContext(dataModel, store);
var storage = ManagedAuthStorage<User>(context)
var authServer = AuthServer(storage);
- Inheritance
-
- Object
- AuthServerDelegate
- ManagedAuthDelegate
Constructors
- ManagedAuthDelegate(ManagedContext? context, {int tokenLimit = 40})
- Creates an instance of this type.
Properties
- context → ManagedContext?
-
The ManagedContext this instance uses to store and retrieve values.
final
- hashCode → int
-
The hash code for this object.
read-onlyinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
read-onlyinherited
- tokenLimit → int
-
The number of tokens and authorization codes a user can have at a time.
final
Methods
-
addClient(
AuthServer server, AuthClient client) → Future -
Must store
client
.override -
addCode(
AuthServer server, AuthCode code) → Future -
Must store
code
.override -
addToken(
AuthServer server, AuthToken token, {AuthCode? issuedFrom}) → Future -
Must store
token
.override -
getAllowedScopes(
ResourceOwner owner) → List< AuthScope> ? -
Returns list of allowed scopes for a given ResourceOwner.
inherited
-
getClient(
AuthServer server, String? clientID) → Future< AuthClient?> -
Must return
AuthClient
for a client ID.override -
getCode(
AuthServer server, String code) → Future< AuthCode?> -
Must return
AuthCode
for its identifiyingcode
.override -
getResourceOwner(
AuthServer server, String username) → Future< T?> -
Must return a
ResourceOwner
for ausername
.override -
getToken(
AuthServer server, {String? byAccessToken, String? byRefreshToken}) → Future< AuthToken?> -
Returns a
AuthToken
searching by its access token or refresh token.override -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a non-existent method or property is accessed.
inherited
-
pruneTokens(
dynamic resourceOwnerIdentifier) → Future -
Deletes expired tokens for
resourceOwnerIdentifier
. -
removeClient(
AuthServer server, String clientID) → Future -
Removes an AuthClient for a client ID.
override
-
removeCode(
AuthServer server, String? code) → Future -
Must remove AuthCode identified by
code
.override -
removeToken(
AuthServer server, AuthCode grantedByCode) → Future -
Must delete a AuthToken granted by
grantedByCode
.override -
removeTokens(
AuthServer server, int resourceOwnerID) → Future -
This method must delete all AuthToken and AuthCodes for a ResourceOwner.
override
-
toString(
) → String -
A string representation of this object.
inherited
-
updateToken(
AuthServer server, String? oldAccessToken, String? newAccessToken, DateTime? newIssueDate, DateTime? newExpirationDate) → Future -
Must update AuthToken with [newAccessToken, [newIssueDate,
newExpirationDate
.override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited