From 496a012eea896333495dd707003021698bab529e Mon Sep 17 00:00:00 2001 From: Carmine DiMascio Date: Fri, 11 Oct 2019 23:53:36 -0400 Subject: [PATCH] Update README.md --- README.md | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 69d658f8..63b0586a 100644 --- a/README.md +++ b/README.md @@ -151,25 +151,24 @@ new OpenApiValidator(options).install(app); - `Promise.reject(Error('optional 'message')` - `Promise.reject(false)` - Note: error status `401` is returned, unless option `i.` above is used - - **Some examples:** - - ```javascript - securityHandlers: { - ApiKeyAuth: (req, scopes, schema) => { - throw Error('my message'); - }, - OpenID: async (req, scopes, schema) => { - throw { status: 403, message: 'forbidden' } - }, - BasicAuth: (req, scopes, schema) => { - return Promise.resolve(false); - }, - ... - } - ``` + Note: error status `401` is returned, unless option `i.` above is used + **Some examples:** + + ```javascript + securityHandlers: { + ApiKeyAuth: (req, scopes, schema) => { + throw Error('my message'); + }, + OpenID: async (req, scopes, schema) => { + throw { status: 403, message: 'forbidden' } + }, + BasicAuth: (req, scopes, schema) => { + return Promise.resolve(false); + }, + ... + } + ``` In order to grant authz, the handler function **must** either: