Update auth.dart

This commit is contained in:
Tobe O 2016-12-23 23:44:28 -05:00 committed by GitHub
parent caa4a6c389
commit b55c687641

View file

@ -5,7 +5,7 @@ import '../../services/user.dart';
@Expose('/api/auth') @Expose('/api/auth')
class AuthController extends Controller { class AuthController extends Controller {
final AngelAuth auth = new AngelAuth(); AngelAuth auth;
deserializer(String id) async => app.service('api/users').read(id); deserializer(String id) async => app.service('api/users').read(id);
serializer(User user) async => user.id; serializer(User user) async => user.id;
@ -26,9 +26,10 @@ class AuthController extends Controller {
@override @override
call(Angel app) async { call(Angel app) async {
// Wire up local authentication, connected to our User service // Wire up local authentication, connected to our User service
auth.serializer = serializer; auth = new AngelAuth(jwtKey: app.jwt_secret)
auth.deserializer = deserializer; ..serializer = serializer
auth.strategies ..deserializer = deserializer;
..strategies
.add(new LocalAuthStrategy(verifier(app.container.make(UserService)))); .add(new LocalAuthStrategy(verifier(app.container.make(UserService))));
await super.call(app); await super.call(app);