Skip to content

Commit 93b05d9

Browse files
committed
add examples and description to scheme
1 parent 915872a commit 93b05d9

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

src/utils.js

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,33 @@ const joi = require('joi')
88
* The plugin options scheme
99
*/
1010
const scheme = joi.object({
11-
realmUrl: joi.string().uri().required(),
12-
clientId: joi.string().min(1).required(),
13-
secret: joi.string().min(1),
11+
realmUrl: joi.string().uri().required()
12+
.description('The absolute uri of the Keycloak realm')
13+
.example('https://localhost:8080/auth/realms/testme'),
14+
clientId: joi.string().min(1).required()
15+
.description('The identifier of the Keycloak client/application')
16+
.example('foobar'),
17+
secret: joi.string().min(1)
18+
.description('The related secret of the Keycloak client/application')
19+
.example('1234-bar-4321-foo'),
1420
publicKey: joi.alternatives().try(
1521
joi.string().regex(/^-----BEGIN(?: RSA)? PUBLIC KEY-----[\s\S]*-----END(?: RSA)? PUBLIC KEY-----\s?$/ig, 'PEM'),
1622
joi.object().type(Buffer),
1723
joi.object({
1824
kty: joi.string().required()
1925
}).unknown(true)
20-
),
21-
minTimeBetweenJwksRequests: joi.number().integer().positive().allow(0).default(0),
26+
).description('The related public key of the Keycloak client/application'),
27+
minTimeBetweenJwksRequests: joi.number().integer().positive().allow(0).default(0)
28+
.description('The minimum time between JWKS requests in seconds')
29+
.example(15),
2230
cache: joi.alternatives().try(joi.object({
2331
segment: joi.string().default('keycloakJwt')
24-
}), joi.boolean()).default(false),
32+
}), joi.boolean()).default(false)
33+
.description('The configuration of the hapi.js cache powered by catbox')
34+
.example('true'),
2535
userInfo: joi.array().items(joi.string().min(1))
36+
.description('List of properties which should be included in the `request.auth.credentials` object')
37+
.example(['name', 'email'])
2638
})
2739
.nand('secret', 'publicKey')
2840
.required()

0 commit comments

Comments
 (0)