pkce factories injected

This commit is contained in:
Tobe O 2018-12-15 02:48:34 -05:00
parent 71611f7f6a
commit 32da3a16b5
2 changed files with 16 additions and 0 deletions

View file

@ -64,4 +64,12 @@ class Pkce {
);
}
}
/// Creates a JSON-serializable representation of this instance.
Map<String, dynamic> toJson() {
return {
'code_challenge': codeChallenge,
'code_challenge_method': codeChallengeMethod
};
}
}

View file

@ -215,6 +215,10 @@ abstract class AuthorizationServer<Client, User> {
state = query['state']?.toString() ?? '';
var responseType = await _getParam(req, 'response_type', state);
req.container.registerLazySingleton<Pkce>((_) {
return new Pkce.fromJson(req.queryParameters, state: state);
});
if (responseType == 'code') {
// Ensure client ID
// TODO: Handle confidential clients
@ -339,6 +343,10 @@ abstract class AuthorizationServer<Client, User> {
state = body['state']?.toString() ?? '';
req.container.registerLazySingleton<Pkce>((_) {
return new Pkce.fromJson(req.bodyAsMap, state: state);
});
var grantType = await _getParam(req, 'grant_type', state,
body: true, throwIfEmpty: false);