From e490afe63723ee835e09bb69db6cf879166a52db Mon Sep 17 00:00:00 2001 From: Tobe O Date: Fri, 9 Nov 2018 13:01:37 -0500 Subject: [PATCH] Bump to 2.0.2 --- CHANGELOG.md | 3 +++ lib/src/plugin.dart | 7 +++++-- pubspec.yaml | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c634eb31..d2989422 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +# 2.0.2 +* Handle `null` return in `authenticate` + `failureRedirect`. + # 2.0.1 * Add generic parameter to `options` on `AuthStrategy.authenticate`. diff --git a/lib/src/plugin.dart b/lib/src/plugin.dart index a1ff1cf0..1236d075 100644 --- a/lib/src/plugin.dart +++ b/lib/src/plugin.dart @@ -277,7 +277,7 @@ class AngelAuth { : await strategy.authenticate(req, res, options); if (result == true) return result; - else if (result != false) { + else if (result != false && result != null) { var userId = await serializer(result); // Create JWT @@ -325,7 +325,10 @@ class AngelAuth { res.statusCode == 302 || res.headers.containsKey('location')) return false; - else + else if (options?.failureRedirect != null) { + res.redirect(options.failureRedirect); + return false; + } else throw new AngelHttpException.notAuthenticated(); } } diff --git a/pubspec.yaml b/pubspec.yaml index 628813af..240d08e5 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: angel_auth description: A complete authentication plugin for Angel. Includes support for stateless JWT tokens, Basic Auth, and more. -version: 2.0.1 +version: 2.0.2 author: Tobe O homepage: https://github.com/angel-dart/angel_auth environment: