+4
This commit is contained in:
parent
013c77aba2
commit
d95c89daae
3 changed files with 15 additions and 8 deletions
|
@ -1,3 +1,7 @@
|
|||
# 1.1.1+4
|
||||
* Patched `logout` to properly erase cookies
|
||||
* Fixed checking of expired tokens.
|
||||
|
||||
# 1.1.1+3
|
||||
* `authenticate` returns the current user, if one is present.
|
||||
|
||||
|
|
|
@ -138,9 +138,10 @@ class AngelAuth<T> {
|
|||
}
|
||||
|
||||
if (token.lifeSpan > -1) {
|
||||
token.issuedAt.add(new Duration(milliseconds: token.lifeSpan.toInt()));
|
||||
var expiry = token.issuedAt
|
||||
.add(new Duration(milliseconds: token.lifeSpan.toInt()));
|
||||
|
||||
if (!token.issuedAt.isAfter(new DateTime.now()))
|
||||
if (!expiry.isAfter(new DateTime.now()))
|
||||
throw new AngelHttpException.forbidden(message: "Expired JWT.");
|
||||
}
|
||||
|
||||
|
@ -209,12 +210,12 @@ class AngelAuth<T> {
|
|||
}
|
||||
|
||||
if (token.lifeSpan > -1) {
|
||||
token.issuedAt
|
||||
var expiry = token.issuedAt
|
||||
.add(new Duration(milliseconds: token.lifeSpan.toInt()));
|
||||
|
||||
if (!token.issuedAt.isAfter(new DateTime.now())) {
|
||||
print(
|
||||
'Token has indeed expired! Resetting assignment date to current timestamp...');
|
||||
if (!expiry.isAfter(new DateTime.now())) {
|
||||
//print(
|
||||
// 'Token has indeed expired! Resetting assignment date to current timestamp...');
|
||||
// Extend its lifespan by changing iat
|
||||
token.issuedAt = new DateTime.now();
|
||||
}
|
||||
|
@ -364,8 +365,10 @@ class AngelAuth<T> {
|
|||
req.injections..remove(AuthToken)..remove('user');
|
||||
req.properties.remove('user');
|
||||
|
||||
if (allowCookie == true)
|
||||
if (allowCookie == true) {
|
||||
res.cookies.removeWhere((cookie) => cookie.name == "token");
|
||||
res.cookies.add(protectCookie(new Cookie('token', '')));
|
||||
}
|
||||
|
||||
if (options != null &&
|
||||
options.successRedirect != null &&
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
name: angel_auth
|
||||
description: A complete authentication plugin for Angel.
|
||||
version: 1.1.1+3
|
||||
version: 1.1.1+4
|
||||
author: Tobe O <thosakwe@gmail.com>
|
||||
homepage: https://github.com/angel-dart/angel_auth
|
||||
environment:
|
||||
|
|
Loading…
Reference in a new issue