diff --git a/README.md b/README.md
index 6e51276b..71c7ba2f 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
# Angel3 Framework
-[![Angel3 Framework](./logo3.png)](https://github.com/dukefirehawk/angel)
+[![Angel3 Framework](./angel3_logo.svg)](https://github.com/dukefirehawk/angel)
![Pub Version (including pre-releases)](https://img.shields.io/pub/v/angel3_framework?include_prereleases)
[![Null Safety](https://img.shields.io/badge/null-safety-brightgreen)](https://dart.dev/null-safety)
diff --git a/angel3_logo.svg b/angel3_logo.svg
new file mode 100644
index 00000000..ea984e5f
--- /dev/null
+++ b/angel3_logo.svg
@@ -0,0 +1,148 @@
+
+
+
+
diff --git a/archived_packages/eventsource.zip b/archived/eventsource.zip
similarity index 100%
rename from archived_packages/eventsource.zip
rename to archived/eventsource.zip
diff --git a/logo.png b/archived/logo.png
similarity index 100%
rename from logo.png
rename to archived/logo.png
diff --git a/logo3.png b/archived/logo3.png
similarity index 100%
rename from logo3.png
rename to archived/logo3.png
diff --git a/archived_packages/orm.zip b/archived/orm.zip
similarity index 100%
rename from archived_packages/orm.zip
rename to archived/orm.zip
diff --git a/archived_packages/poll.zip b/archived/poll.zip
similarity index 100%
rename from archived_packages/poll.zip
rename to archived/poll.zip
diff --git a/archived_packages/relations.zip b/archived/relations.zip
similarity index 100%
rename from archived_packages/relations.zip
rename to archived/relations.zip
diff --git a/archived_packages/rethink.zip b/archived/rethink.zip
similarity index 100%
rename from archived_packages/rethink.zip
rename to archived/rethink.zip
diff --git a/archived_packages/seeder.zip b/archived/seeder.zip
similarity index 100%
rename from archived_packages/seeder.zip
rename to archived/seeder.zip
diff --git a/tool/archived/move_repos b/archived/tool/archived/move_repos
similarity index 100%
rename from tool/archived/move_repos
rename to archived/tool/archived/move_repos
diff --git a/tool/archived/pull_subproject b/archived/tool/archived/pull_subproject
similarity index 100%
rename from tool/archived/pull_subproject
rename to archived/tool/archived/pull_subproject
diff --git a/archived_packages/typed_service.zip b/archived/typed_service.zip
similarity index 100%
rename from archived_packages/typed_service.zip
rename to archived/typed_service.zip
diff --git a/archived_packages/wings.zip b/archived/wings.zip
similarity index 100%
rename from archived_packages/wings.zip
rename to archived/wings.zip
diff --git a/logo3.xcf b/logo3.xcf
deleted file mode 100644
index abff3b69..00000000
Binary files a/logo3.xcf and /dev/null differ
diff --git a/logo_icon_512.png b/logo_icon_512.png
new file mode 100644
index 00000000..b0b3f975
Binary files /dev/null and b/logo_icon_512.png differ
diff --git a/packages/framework/lib/src/core/driver.dart b/packages/framework/lib/src/core/driver.dart
index fb328f4e..47e5e982 100644
--- a/packages/framework/lib/src/core/driver.dart
+++ b/packages/framework/lib/src/core/driver.dart
@@ -108,6 +108,8 @@ abstract class Driver<
/// Handles a single request.
Future handleRawRequest(Request request, Response response) {
+ app.logger.info('[Server] Called handleRawRequest');
+
return createRequestContext(request, response).then((req) {
return createResponseContext(request, response, req).then((res) {
Future handle() {
diff --git a/packages/oauth2/README.md b/packages/oauth2/README.md
index ec243fda..4e16a747 100644
--- a/packages/oauth2/README.md
+++ b/packages/oauth2/README.md
@@ -20,8 +20,8 @@ In your `pubspec.yaml`:
```yaml
dependencies:
- angel3_framework: ^6.0.0
- angel3_oauth2: ^6.0.0
+ angel3_framework: ^8.0.0
+ angel3_oauth2: ^8.0.0
```
## Usage
diff --git a/packages/oauth2/example/example1.dart b/packages/oauth2/example/example1.dart
new file mode 100644
index 00000000..84142a73
--- /dev/null
+++ b/packages/oauth2/example/example1.dart
@@ -0,0 +1,94 @@
+import 'dart:async';
+
+import 'package:angel3_container/mirrors.dart';
+import 'package:angel3_framework/angel3_framework.dart';
+import 'package:angel3_oauth2/angel3_oauth2.dart';
+import 'package:logging/logging.dart';
+
+import '../test/common.dart';
+
+void main() {
+ Logger.root.level = Level.ALL;
+ Logger.root.onRecord.listen((record) {
+ print(
+ '${record.time} ${record.level.name.padLeft(6, ' ')} [${record.loggerName}] : ${record.message}');
+ if (record.error != null) print(record.error);
+ if (record.stackTrace != null) print(record.stackTrace);
+ });
+
+ // Declae the function
+ void setUp() async {
+ var app = Angel(reflector: MirrorsReflector());
+ var oauth2 = _AuthorizationServer();
+
+ app.group('/oauth2', (router) {
+ router
+ ..get('/authorize', oauth2.authorizationEndpoint)
+ ..post('/token', oauth2.tokenEndpoint);
+ });
+
+ //app.logger.level = Level.ALL;
+ app.logger = Logger("oauth2")
+ ..onRecord.listen((rec) {
+ print(rec);
+ if (rec.error != null) print(rec.error);
+ if (rec.stackTrace != null) print(rec.stackTrace);
+ });
+
+ app.errorHandler = (e, req, res) async {
+ res.json(e.toJson());
+ };
+ }
+
+ setUp();
+}
+
+class _AuthorizationServer
+ extends AuthorizationServer {
+ var logger = Logger('AuthorizationServer');
+
+ @override
+ PseudoApplication? findClient(String? clientId) {
+ return clientId == pseudoApplication.id ? pseudoApplication : null;
+ }
+
+ @override
+ Future verifyClient(
+ PseudoApplication client, String? clientSecret) async {
+ return client.secret == clientSecret;
+ }
+
+ @override
+ FutureOr requestDeviceCode(PseudoApplication client,
+ Iterable scopes, RequestContext req, ResponseContext res) {
+ return DeviceCodeResponse(
+ 'foo',
+ 'bar',
+ Uri.parse('https://regiostech.com')
+ .replace(queryParameters: {'scopes': scopes.join(',')}),
+ 3600);
+ }
+
+ @override
+ FutureOr exchangeDeviceCodeForToken(
+ PseudoApplication client,
+ String? deviceCode,
+ String state,
+ RequestContext req,
+ ResponseContext res) {
+ print("[Server] exchangeDeviceCodeForToken");
+ print("[Server] $deviceCode");
+ print("[Server] $client");
+
+ if (deviceCode == 'brute') {
+ print("[Server] Throws AuthorizationException");
+
+ throw AuthorizationException(ErrorResponse(
+ ErrorResponse.slowDown,
+ 'Ho, brother! Ho, whoa, whoa, whoa now! You got too much dip on your chip!',
+ state));
+ }
+
+ return AuthorizationTokenResponse('foo');
+ }
+}
diff --git a/packages/oauth2/lib/src/server.dart b/packages/oauth2/lib/src/server.dart
index 8bfa68ad..4bc643c1 100644
--- a/packages/oauth2/lib/src/server.dart
+++ b/packages/oauth2/lib/src/server.dart
@@ -1,6 +1,7 @@
import 'dart:async';
import 'dart:convert';
import 'package:angel3_framework/angel3_framework.dart';
+import 'package:logging/logging.dart';
import 'exception.dart';
import 'pkce.dart';
import 'response.dart';
@@ -51,6 +52,8 @@ Future> _getScopes(RequestContext req,
/// An OAuth2 authorization server, which issues access tokens to third parties.
abstract class AuthorizationServer {
+ static Logger logger = Logger('AuthorizationServer');
+
const AuthorizationServer();
static const String _internalServerError =
diff --git a/packages/oauth2/pubspec.yaml b/packages/oauth2/pubspec.yaml
index 61ef4e52..d9a80137 100644
--- a/packages/oauth2/pubspec.yaml
+++ b/packages/oauth2/pubspec.yaml
@@ -11,10 +11,11 @@ dependencies:
angel3_http_exception: ^8.0.0
crypto: ^3.0.1
collection: ^1.17.0
+ logging: ^1.2.0
dev_dependencies:
angel3_validate: ^8.0.0
angel3_test: ^8.0.0
- logging: ^1.2.0
+ angel3_container: ^8.0.0
oauth2: ^2.0.0
lints: ^2.1.0
test: ^1.24.0
diff --git a/packages/oauth2/test/device_code_test.dart b/packages/oauth2/test/device_code_test.dart
index 62d9e388..a255afc2 100644
--- a/packages/oauth2/test/device_code_test.dart
+++ b/packages/oauth2/test/device_code_test.dart
@@ -1,4 +1,5 @@
import 'dart:async';
+import 'package:angel3_container/mirrors.dart';
import 'package:angel3_framework/angel3_framework.dart';
import 'package:angel3_test/angel3_test.dart';
import 'package:angel3_oauth2/angel3_oauth2.dart';
@@ -10,7 +11,7 @@ void main() {
late TestClient client;
setUp(() async {
- var app = Angel();
+ var app = Angel(reflector: MirrorsReflector());
var oauth2 = _AuthorizationServer();
app.group('/oauth2', (router) {
@@ -19,7 +20,8 @@ void main() {
..post('/token', oauth2.tokenEndpoint);
});
- app.logger = Logger('angel_oauth2')
+ //app.logger.level = Level.ALL;
+ app.logger = Logger("oauth2")
..onRecord.listen((rec) {
print(rec);
if (rec.error != null) print(rec.error);
@@ -113,7 +115,8 @@ void main() {
'device_code': 'brute',
});
- print(response.body);
+ print("[Client] ${response.headers}");
+ print("[Client] ${response.body}");
expect(
response,
allOf(
@@ -130,6 +133,8 @@ void main() {
class _AuthorizationServer
extends AuthorizationServer {
+ var logger = Logger('AuthorizationServer');
+
@override
PseudoApplication? findClient(String? clientId) {
return clientId == pseudoApplication.id ? pseudoApplication : null;
@@ -159,7 +164,13 @@ class _AuthorizationServer
String state,
RequestContext req,
ResponseContext res) {
+ print("[Server] exchangeDeviceCodeForToken");
+ print("[Server] $deviceCode");
+ print("[Server] $client");
+
if (deviceCode == 'brute') {
+ print("[Server] Throws AuthorizationException");
+
throw AuthorizationException(ErrorResponse(
ErrorResponse.slowDown,
'Ho, brother! Ho, whoa, whoa, whoa now! You got too much dip on your chip!',
diff --git a/packages/oauth2/test/pkce_test.dart b/packages/oauth2/test/pkce_test.dart
index 0b58cc3b..11e3905d 100644
--- a/packages/oauth2/test/pkce_test.dart
+++ b/packages/oauth2/test/pkce_test.dart
@@ -1,5 +1,6 @@
import 'dart:async';
import 'dart:collection';
+import 'package:angel3_container/mirrors.dart';
import 'package:angel3_framework/angel3_framework.dart';
import 'package:angel3_framework/http.dart';
import 'package:angel3_oauth2/angel3_oauth2.dart';
@@ -14,7 +15,7 @@ void main() {
late TestClient testClient;
setUp(() async {
- app = Angel();
+ app = Angel(reflector: MirrorsReflector());
app.container.registerSingleton(AuthCodes());
var server = _Server();