managed_auth library
Library for implementing OAuth 2.0 storage using ManagedObjects.
This library contains ManagedObject subclasses to represent OAuth 2.0 artifacts and implements AuthServerDelegate for use by an AuthServer. Usage of this library involves two tasks. First, an instance of ManagedAuthDelegate is provided to an AuthServer at startup:
var context = ManagedContext(dataModel, store);
var storage = ManagedAuthStorage<User>(context)
var authServer = AuthServer(storage);
Then, a ManagedObject subclass that represents an OAuth 2.0 resource owner ust be declared. It must implement ManagedAuthResourceOwner.
Its table definition must implement ResourceOwnerTableDefinition. For example, the follower User
fulfills the requirement:
class User extends ManagedObject<_User> implements _User, ManagedAuthResourceOwner {}
class _User extends ManagedAuthenticatable { ... }
This library must be visible from the application's library file - that is, for an application named
'foo', this library must be imported in foo/foo.dart
.
This library declares two ManagedObject subclasses, ManagedAuthToken and ManagedAuthClient.
An application using this library must ensure that these two types have corresponding database tables.
The liquidart db
tool will create database tables for these types as long as they are visible
to the application's library file, as noted above.
Classes
- ManagedAuthClient
- Represent OAuth 2.0 clients.
-
ManagedAuthDelegate<
T extends ManagedAuthResourceOwner> - AuthServerDelegate implementation for an AuthServer using ManagedObjects.
-
ManagedAuthResourceOwner<
T> - REQUIRED: An OAuth 2.0 Resource Owner as a ManagedObject.
- ManagedAuthToken
- Represent an OAuth 2.0 authorization token and authorization code.
- ResourceOwnerTableDefinition
- REQUIRED: Represents an OAuth 2.0 Resource Owner database table.