This commit is contained in:
Tobe O 2017-10-16 12:52:12 -04:00
parent 0fb8c68c0c
commit 06c4535bac
4 changed files with 12 additions and 12 deletions

View file

@ -7,7 +7,7 @@ class AuthorizationException extends AngelHttpException {
AuthorizationException(this.errorResponse, AuthorizationException(this.errorResponse,
{StackTrace stackTrace, int statusCode, error}) {StackTrace stackTrace, int statusCode, error})
: super(error ?? errorResponse, : super(error ?? errorResponse,
stackTrace: stackTrace, message: '', statusCode: statusCode ?? 401); stackTrace: stackTrace, message: '', statusCode: statusCode ?? 400);
@override @override
Map toJson() { Map toJson() {

View file

@ -66,7 +66,7 @@ abstract class AuthorizationServer<Client, User> {
'Authorization code grants are not supported.', 'Authorization code grants are not supported.',
state, state,
), ),
statusCode: 405, statusCode: 400,
); );
} }
@ -87,7 +87,7 @@ abstract class AuthorizationServer<Client, User> {
'Authorization code grants are not supported.', 'Authorization code grants are not supported.',
state, state,
), ),
statusCode: 405, statusCode: 400,
); );
} }
@ -103,7 +103,7 @@ abstract class AuthorizationServer<Client, User> {
'Authorization code grants are not supported.', 'Authorization code grants are not supported.',
req.query['state'] ?? '', req.query['state'] ?? '',
), ),
statusCode: 405, statusCode: 400,
); );
} }
@ -120,7 +120,7 @@ abstract class AuthorizationServer<Client, User> {
'Refreshing authorization tokens is not supported.', 'Refreshing authorization tokens is not supported.',
req.body['state'] ?? '', req.body['state'] ?? '',
), ),
statusCode: 405, statusCode: 400,
); );
} }
@ -138,7 +138,7 @@ abstract class AuthorizationServer<Client, User> {
'Resource owner password credentials grants are not supported.', 'Resource owner password credentials grants are not supported.',
req.body['state'] ?? '', req.body['state'] ?? '',
), ),
statusCode: 405, statusCode: 400,
); );
} }
@ -151,7 +151,7 @@ abstract class AuthorizationServer<Client, User> {
'Client credentials grants are not supported.', 'Client credentials grants are not supported.',
req.body['state'] ?? '', req.body['state'] ?? '',
), ),
statusCode: 405, statusCode: 400,
); );
} }
@ -319,7 +319,7 @@ abstract class AuthorizationServer<Client, User> {
'Invalid "client_id" parameter.', 'Invalid "client_id" parameter.',
state, state,
), ),
statusCode: 401, statusCode: 400,
); );
} }
@ -330,7 +330,7 @@ abstract class AuthorizationServer<Client, User> {
'Invalid "client_secret" parameter.', 'Invalid "client_secret" parameter.',
state, state,
), ),
statusCode: 401, statusCode: 400,
); );
} }
} }

View file

@ -2,7 +2,7 @@ name: angel_oauth2
author: Tobe O <thosakwe@gmail.com> author: Tobe O <thosakwe@gmail.com>
description: angel_auth strategy for in-house OAuth2 login. description: angel_auth strategy for in-house OAuth2 login.
homepage: https://github.com/thosakwe/oauth2_server.git homepage: https://github.com/thosakwe/oauth2_server.git
version: 1.0.0-alpha version: 1.0.0-alpha+1
environment: environment:
sdk: ">=1.19.0" sdk: ">=1.19.0"
dependencies: dependencies:

View file

@ -65,7 +65,7 @@ main() {
); );
print('Response: ${response.body}'); print('Response: ${response.body}');
expect(response, hasStatus(401)); expect(response, hasStatus(400));
}); });
test('force correct secret', () async { test('force correct secret', () async {
@ -80,7 +80,7 @@ main() {
); );
print('Response: ${response.body}'); print('Response: ${response.body}');
expect(response, hasStatus(401)); expect(response, hasStatus(400));
}); });
} }