| 124 | } |
| 125 | |
| 126 | interface IAsyncAuthorizerOptions extends IBaseOptions { |
| 127 | /** |
| 128 | * Set it to true to use a asynchronous authorizer. |
| 129 | */ |
| 130 | authorizeAsync: true |
| 131 | |
| 132 | /** |
| 133 | * You can pass an asynchronous authorizer. It will be passed a callback as the third parameter, which is |
| 134 | * expected to be called by standard node convention with an error and a boolean to indicate if the credentials |
| 135 | * have been approved or not. |
| 136 | * |
| 137 | * Example: |
| 138 | * app.use(basicAuth({ authorizer, authorizeAsync: true })); |
| 139 | * |
| 140 | * function authorizer(username, password, authorize) { |
| 141 | * if(username.startsWith('A') && password.startsWith('secret')) |
| 142 | * return authorize(null, true) |
| 143 | * |
| 144 | * return authorize(null, false) |
| 145 | * } |
| 146 | */ |
| 147 | authorizer: AsyncAuthorizer |
| 148 | } |
| 149 | } |
| 150 | |
| 151 | export = expressBasicAuth |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…