Controller docs
This commit is contained in:
parent
caa2842efa
commit
d21fa4f545
2 changed files with 11 additions and 1 deletions
|
@ -3,8 +3,17 @@ library angel.routes.controllers.auth;
|
|||
import 'package:angel_common/angel_common.dart';
|
||||
import '../../services/user.dart';
|
||||
|
||||
/// Configures the application to authenticate users securely.
|
||||
/// See the documentation for controllers:
|
||||
///
|
||||
/// https://github.com/angel-dart/angel/wiki/Controllers
|
||||
@Expose('/auth')
|
||||
class AuthController extends Controller {
|
||||
/// Controls application authentication.
|
||||
///
|
||||
/// See the documentation:
|
||||
/// * https://medium.com/the-angel-framework/logging-users-in-to-angel-applications-ccf32aba0dac
|
||||
/// * https://github.com/angel-dart/auth
|
||||
AngelAuth auth;
|
||||
|
||||
/// Clients will see the result of `deserializer`, so let's pretend to be a client.
|
||||
|
@ -15,7 +24,7 @@ class AuthController extends Controller {
|
|||
|
||||
serializer(User user) async => user.id;
|
||||
|
||||
/// Attempt to log a user in
|
||||
/// Attempts to log a user in.
|
||||
LocalAuthVerifier localVerifier(Service userService) {
|
||||
return (String username, String password) async {
|
||||
Iterable<User> users = await userService.index({
|
||||
|
|
|
@ -4,5 +4,6 @@ import 'package:angel_common/angel_common.dart';
|
|||
import 'auth.dart';
|
||||
|
||||
configureServer(Angel app) async {
|
||||
/// Controllers will not function unless wired to the application!
|
||||
await app.configure(new AuthController());
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue