Skip to content

Commit 0a86e69

Browse files
updated documentation
1 parent 88ef515 commit 0a86e69

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

docs/model/overview.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ Model functions used by the authorization code grant:
3737
- :ref:`Model#saveAuthorizationCode`
3838
- :ref:`Model#revokeAuthorizationCode`
3939
- :ref:`Model#validateScope`
40+
- :ref:`Model#validateRedirectUri`
4041

4142
--------
4243

docs/model/spec.rst

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -985,3 +985,40 @@ Returns ``true`` if the access token passes, ``false`` otherwise.
985985
return requestedScopes.every(s => authorizedScopes.indexOf(s) >= 0);
986986
}
987987

988+
--------
989+
990+
.. _Model#validateRedirectUri:
991+
992+
``validateRedirectUri(redirect_uri, redirect_uris, [callback])``
993+
================================================================
994+
995+
Invoked to check if the provided ``redirect_uri`` is valid for a particular ``client``.
996+
997+
This model function is **optional**. If not implemented, the redirect_uri should be included in the provided redirect_uris of the client.
998+
999+
**Invoked during:**
1000+
1001+
- ``authorization_code`` grant
1002+
1003+
**Arguments:**
1004+
1005+
+-----------------+----------+---------------------------------------------------------------------+
1006+
| Name | Type | Description |
1007+
+=================+==========+=====================================================================+
1008+
| redirect_uri | String | The redirect URI to validate. |
1009+
+-----------------+----------+---------------------------------------------------------------------+
1010+
| redirect_uris | Array | The list of redirect URIs configured for the client. |
1011+
+-----------------+----------+---------------------------------------------------------------------+
1012+
1013+
**Return value:**
1014+
1015+
Returns ``true`` if the ``redirect_uri`` is valid, ``false`` otherwise.
1016+
1017+
**Remarks:**
1018+
1019+
::
1020+
1021+
function validateRedirectUri(redirect_uri, redirect_uris) {
1022+
return redirect_uris.includes(redirect_uri);
1023+
}
1024+

0 commit comments

Comments
 (0)