+11
This commit is contained in:
parent
5b7e017f31
commit
148c9cbc18
4 changed files with 10 additions and 5 deletions
|
@ -1,6 +1,6 @@
|
|||
# angel_auth
|
||||
|
||||
![version 1.1.0-dev+10](https://img.shields.io/badge/version-1.1.0--dev+10-red.svg)
|
||||
![version 1.1.0-dev+11](https://img.shields.io/badge/version-1.1.0--dev+11-red.svg)
|
||||
![build status](https://travis-ci.org/angel-dart/auth.svg?branch=master)
|
||||
|
||||
A complete authentication plugin for Angel. Inspired by Passport.
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
class AngelAuthOptions {
|
||||
bool canRespondWithJson;
|
||||
String successRedirect;
|
||||
String failureRedirect;
|
||||
|
||||
AngelAuthOptions({String this.successRedirect, String this.failureRedirect});
|
||||
}
|
||||
AngelAuthOptions(
|
||||
{this.canRespondWithJson: true,
|
||||
this.successRedirect,
|
||||
String this.failureRedirect});
|
||||
}
|
||||
|
|
|
@ -232,7 +232,8 @@ class AngelAuth extends AngelPlugin {
|
|||
|
||||
if (allowCookie) req.cookies.add(new Cookie("token", jwt));
|
||||
|
||||
if (req.headers.value("accept") != null &&
|
||||
if (options?.canRespondWithJson != false &&
|
||||
req.headers.value("accept") != null &&
|
||||
(req.headers.value("accept").contains("application/json") ||
|
||||
req.headers.value("accept").contains("*/*") ||
|
||||
req.headers.value("accept").contains("application/*"))) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
name: angel_auth
|
||||
description: A complete authentication plugin for Angel.
|
||||
version: 1.0.0-dev+10
|
||||
version: 1.0.0-dev+11
|
||||
author: Tobe O <thosakwe@gmail.com>
|
||||
homepage: https://github.com/angel-dart/angel_auth
|
||||
dependencies:
|
||||
|
|
Loading…
Reference in a new issue