Skip to content

Commit bcd71c2

Browse files
committed
rename functions
1 parent f55ad5d commit bcd71c2

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/index.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,29 +18,29 @@ let manager
1818
* @function
1919
* @private
2020
*
21-
* Validate the token offline with help of
22-
* the related public key. Resolve if the
23-
* verification succeeded.
21+
* Validate the signed token offline with help of the related
22+
* public key or online with help of the Keycloak server and
23+
* JWKS. Resolve if the verification succeeded.
2424
*
2525
* @param {string} token The token to be validated
2626
* @returns {Promise} The error-handled promise
2727
*/
28-
function validateOffline (token) {
28+
function validateSignedJwt (token) {
2929
return manager.validateToken(new Token(token, options.clientId))
3030
}
3131

3232
/**
3333
* @function
3434
* @private
3535
*
36-
* Validate the token online with help of
37-
* the related Keycloak server. Resolve if
38-
* the request succeeded and token is valid.
36+
* Validate the token online with help of the related
37+
* Keycloak server, the client identifier and its secret.
38+
* Resolve if the request succeeded and token is valid.
3939
*
4040
* @param {string} token The token to be validated
4141
* @returns {Promise} The error-handled promise
4242
*/
43-
function validateOnline (token) {
43+
function validateSecret (token) {
4444
return manager.validateAccessToken(token).then((res) => {
4545
if (res === false) {
4646
throw Error(error.msg.invalid)
@@ -62,7 +62,7 @@ function validateOnline (token) {
6262
* @param {Function} reply The callback handler
6363
*/
6464
function handleKeycloakValidation (tkn, reply) {
65-
const validateFn = options.secret ? validateOnline : validateOffline
65+
const validateFn = options.secret ? validateSecret : validateSignedJwt
6666

6767
validateFn(tkn.get()).then(() => {
6868
const { expiresIn, credentials } = tkn.getData(options.userInfo)

0 commit comments

Comments
 (0)