From 0382a7ffb60589c872a77f37800882f69eed0e8d Mon Sep 17 00:00:00 2001 From: Tobe O Date: Sun, 4 Dec 2016 20:20:12 -0500 Subject: [PATCH] Update auth.dart --- lib/src/routes/controllers/auth.dart | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/src/routes/controllers/auth.dart b/lib/src/routes/controllers/auth.dart index 8b0b789..d28d7fa 100644 --- a/lib/src/routes/controllers/auth.dart +++ b/lib/src/routes/controllers/auth.dart @@ -4,15 +4,15 @@ import 'package:angel_auth/angel_auth.dart'; import 'package:angel_framework/angel_framework.dart'; import '../../services/user.dart'; -@Expose("/auth") +@Expose("/api/auth") class AuthController extends Controller { - final AngelAuth _auth = new AngelAuth(); + final AngelAuth auth = new AngelAuth(); - _deserializer(String id) async => app.service("api/users").read(id); - _serializer(User user) async => user.id; + deserializer(String id) async => app.service("api/users").read(id); + serializer(User user) async => user.id; /// Attempt to log a user in - _verifier(UserService Users) { + verifier(UserService Users) { return (String username, String password) async { List users = await Users.index({"username": username}); @@ -27,13 +27,13 @@ class AuthController extends Controller { @override call(Angel app) async { // Wire up local authentication, connected to our User service - _auth.serializer = _serializer; - _auth.deserializer = _deserializer; - _auth.strategies - .add(new LocalAuthStrategy(_verifier(app.container.make(UserService)))); + auth.serializer = serializer; + auth.deserializer = deserializer; + auth.strategies + .add(new LocalAuthStrategy(verifier(app.container.make(UserService)))); await super.call(app); - await app.configure(_auth); + await app.configure(auth); } bool loggedIn(RequestContext req) => req.session["userId"] != null;