1.0.0
This commit is contained in:
parent
e163c1b9e9
commit
a773990f61
4 changed files with 44 additions and 2 deletions
12
README.md
12
README.md
|
@ -1,6 +1,6 @@
|
|||
# angel_auth
|
||||
|
||||
[![version 1.1.0-dev+18](https://img.shields.io/badge/version-1.1.0--dev+18-red.svg)](https://pub.dartlang.org/packages/angel_auth)
|
||||
[![version 1.0.0](https://img.shields.io/badge/version-1.0.0-brightgreen.svg)](https://pub.dartlang.org/packages/angel_auth)
|
||||
![build status](https://travis-ci.org/angel-dart/auth.svg?branch=master)
|
||||
|
||||
A complete authentication plugin for Angel. Inspired by Passport.
|
||||
|
@ -10,3 +10,13 @@ A complete authentication plugin for Angel. Inspired by Passport.
|
|||
|
||||
# Supported Strategies
|
||||
* Local (with and without Basic Auth)
|
||||
|
||||
# Default Authentication Callback
|
||||
A frequent use case within SPA's is opening OAuth login endpoints in a separate window.
|
||||
[`angel_client`](https://github.com/angel-dart/client)
|
||||
provides a facility for this, which works perfectly with the default callback provided
|
||||
in this package.
|
||||
|
||||
```dart
|
||||
app.authenticate('facebook', new AngelAuthOptions(callback: confirmPopupAuthentication()));
|
||||
```
|
||||
|
|
|
@ -6,4 +6,5 @@ export 'src/auth_token.dart';
|
|||
export 'src/defs.dart';
|
||||
export 'src/options.dart';
|
||||
export 'src/plugin.dart';
|
||||
export 'src/popup_page.dart';
|
||||
export 'src/strategy.dart';
|
||||
|
|
31
lib/src/popup_page.dart
Normal file
31
lib/src/popup_page.dart
Normal file
|
@ -0,0 +1,31 @@
|
|||
import 'dart:io';
|
||||
import 'package:angel_framework/angel_framework.dart';
|
||||
import 'options.dart';
|
||||
|
||||
/// Displays a default callback page to confirm authentication via popups.
|
||||
AngelAuthCallback confirmPopupAuthentication({String eventName: 'token'}) {
|
||||
return (req, ResponseContext res, String jwt) async {
|
||||
res
|
||||
..contentType = ContentType.HTML
|
||||
..write('''
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Authentication Success</title>
|
||||
<script>
|
||||
var ev = new CustomEvent('$eventName', { detail: '$jwt' });
|
||||
window.opener.dispatchEvent(ev);
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Authentication Success</h1>
|
||||
<p>
|
||||
Now logging you in... If you continue to see this page, you may need to enable JavaScript.
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
''');
|
||||
return false;
|
||||
};
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
name: angel_auth
|
||||
description: A complete authentication plugin for Angel.
|
||||
version: 1.0.0-dev+18
|
||||
version: 1.0.0
|
||||
author: Tobe O <thosakwe@gmail.com>
|
||||
homepage: https://github.com/angel-dart/angel_auth
|
||||
environment:
|
||||
|
|
Loading…
Reference in a new issue