+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
|
# 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)
|
![build status](https://travis-ci.org/angel-dart/auth.svg?branch=master)
|
||||||
|
|
||||||
A complete authentication plugin for Angel. Inspired by Passport.
|
A complete authentication plugin for Angel. Inspired by Passport.
|
||||||
|
|
|
@ -1,6 +1,10 @@
|
||||||
class AngelAuthOptions {
|
class AngelAuthOptions {
|
||||||
|
bool canRespondWithJson;
|
||||||
String successRedirect;
|
String successRedirect;
|
||||||
String failureRedirect;
|
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 (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("application/json") ||
|
||||||
req.headers.value("accept").contains("*/*") ||
|
req.headers.value("accept").contains("*/*") ||
|
||||||
req.headers.value("accept").contains("application/*"))) {
|
req.headers.value("accept").contains("application/*"))) {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
name: angel_auth
|
name: angel_auth
|
||||||
description: A complete authentication plugin for Angel.
|
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>
|
author: Tobe O <thosakwe@gmail.com>
|
||||||
homepage: https://github.com/angel-dart/angel_auth
|
homepage: https://github.com/angel-dart/angel_auth
|
||||||
dependencies:
|
dependencies:
|
||||||
|
|
Loading…
Reference in a new issue