Skip to content

Commit 3df52fd

Browse files
author
Francesco Stefanni
committed
supported custom validateRedirectUri
1 parent 1b91ddc commit 3df52fd

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/handlers/authorize-handler.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ AuthorizeHandler.prototype.getAuthorizationCodeLifetime = function() {
160160
*/
161161

162162
AuthorizeHandler.prototype.getClient = function(request) {
163+
const self = this;
163164
const clientId = request.body.client_id || request.query.client_id;
164165

165166
if (!clientId) {
@@ -193,7 +194,11 @@ AuthorizeHandler.prototype.getClient = function(request) {
193194
throw new InvalidClientError('Invalid client: missing client `redirectUri`');
194195
}
195196

196-
if (redirectUri && !client.redirectUris.includes(redirectUri)) {
197+
if (redirectUri && typeof self.model.validateRedirectUri === 'function') {
198+
if (self.model.validateRedirectUri(redirectUri, client.redirectUris)) {
199+
throw new InvalidClientError('Invalid client: `redirect_uri` does not match client value');
200+
}
201+
} else if (redirectUri && !client.redirectUris.includes(redirectUri)) {
197202
throw new InvalidClientError('Invalid client: `redirect_uri` does not match client value');
198203
}
199204
return client;

0 commit comments

Comments
 (0)