Updated configuration

This commit is contained in:
Thomas Hii 2023-05-21 11:02:54 +00:00
parent b2618316ef
commit b8475b01b8
5 changed files with 30 additions and 43 deletions

View file

@ -10,8 +10,8 @@
* Upgraded: angel3_container_generator * Upgraded: angel3_container_generator
* Upgraded: angel3_mock_request * Upgraded: angel3_mock_request
* Upgraded: angel3_framework * Upgraded: angel3_framework
* Upgraded: angel3_auth (todo) * Upgraded: angel3_auth
* Upgraded: angel3_configuration (todo) * Upgraded: angel3_configuration
* Upgraded: angel3_validate (todo) * Upgraded: angel3_validate (todo)
## 7.0.0 ## 7.0.0

View file

@ -5,8 +5,6 @@ import 'package:angel3_framework/angel3_framework.dart';
import '../options.dart'; import '../options.dart';
import '../strategy.dart'; import '../strategy.dart';
bool _validateString(String? str) => str != null && str.isNotEmpty;
/// Determines the validity of an incoming username and password. /// Determines the validity of an incoming username and password.
// typedef FutureOr<User> LocalAuthVerifier<User>(String? username, String? password); // typedef FutureOr<User> LocalAuthVerifier<User>(String? username, String? password);
typedef LocalAuthVerifier<User> = FutureOr<User?> Function( typedef LocalAuthVerifier<User> = FutureOr<User?> Function(
@ -72,22 +70,7 @@ class LocalAuthStrategy<User> extends AuthStrategy<User> {
} }
} }
if (verificationResult == null) { if (verificationResult is Map && verificationResult.isEmpty) {
var body = await req
.parseBody()
.then((_) => req.bodyAsMap)
.catchError((_) => <String, dynamic>{});
//if (body != null) {
if (_validateString(body[usernameField].toString()) &&
_validateString(body[passwordField].toString())) {
verificationResult = await verifier(
body[usernameField].toString(), body[passwordField].toString());
}
//}
}
if (verificationResult == null ||
(verificationResult is Map && verificationResult.isEmpty)) {
if (localOptions.failureRedirect != null && if (localOptions.failureRedirect != null &&
localOptions.failureRedirect!.isNotEmpty) { localOptions.failureRedirect!.isNotEmpty) {
await res.redirect(localOptions.failureRedirect, code: 401); await res.redirect(localOptions.failureRedirect, code: 401);

View file

@ -11,7 +11,7 @@ void main() {
secureCookies: true, secureCookies: true,
cookieDomain: 'SECURE', cookieDomain: 'SECURE',
jwtLifeSpan: threeDays.inMilliseconds, jwtLifeSpan: threeDays.inMilliseconds,
serializer: (u) => u as String, serializer: (u) => u,
deserializer: (u) => u); deserializer: (u) => u);
setUp(() => defaultCookie = Cookie('a', 'b')); setUp(() => defaultCookie = Cookie('a', 'b'));

View file

@ -1,5 +1,9 @@
# Change Log # Change Log
## 8.0.0
* Require Dart >= 3.0
## 7.0.0 ## 7.0.0
* Require Dart >= 2.17 * Require Dart >= 2.17

View file

@ -1,32 +1,32 @@
name: angel3_configuration name: angel3_configuration
version: 7.0.0 version: 8.0.0
description: Automatic YAML application configuration loader for Angel 3, with .env support. description: Automatic YAML application configuration loader for Angel 3, with .env support.
homepage: https://angel3-framework.web.app/ homepage: https://angel3-framework.web.app/
repository: https://github.com/dukefirehawk/angel/tree/master/packages/configuration repository: https://github.com/dukefirehawk/angel/tree/master/packages/configuration
environment: environment:
sdk: '>=3.0.0 <4.0.0' sdk: '>=3.0.0 <4.0.0'
dependencies: dependencies:
angel3_framework: ^7.0.0 angel3_framework: ^8.0.0
belatuk_merge_map: ^4.0.0 belatuk_merge_map: ^5.0.0
dotenv: ^4.0.0 dotenv: ^4.1.0
file: ^6.1.0 file: ^7.0.0
yaml: ^3.1.0 yaml: ^3.1.0
dev_dependencies: dev_dependencies:
io: ^1.0.0 io: ^1.0.0
logging: ^1.0.1 logging: ^1.1.0
lints: ^2.0.0 lints: ^2.1.0
belatuk_pretty_logging: ^5.0.0 belatuk_pretty_logging: ^6.0.0
test: ^1.21.0 test: ^1.24.0
# dependency_overrides: dependency_overrides:
# angel3_container: angel3_container:
# path: ../container/angel_container path: ../container/angel_container
# angel3_framework: angel3_framework:
# path: ../framework path: ../framework
# angel3_http_exception: angel3_http_exception:
# path: ../http_exception path: ../http_exception
# angel3_model: angel3_model:
# path: ../model path: ../model
# angel3_route: angel3_route:
# path: ../route path: ../route
# angel3_mock_request: angel3_mock_request:
# path: ../mock_request path: ../mock_request