ManagedAuthDelegate<T extends ManagedAuthResourceOwner> class
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.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- 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 identifiying
code
.override -
getResourceOwner(
AuthServer server, String username) → Future< T?> -
Must return a ResourceOwner for a
username
.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 nonexistent 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