| 100 | } |
| 101 | |
| 102 | interface IAuthorizerOptions extends IBaseOptions { |
| 103 | /** |
| 104 | * Set to true if your authorizer is asynchronous. |
| 105 | */ |
| 106 | authorizeAsync?: false |
| 107 | |
| 108 | /** |
| 109 | * You can pass your own authorizer function, to check the credentials however you want. |
| 110 | * It will be called with a username and password and is expected to return true or false to indicate that the |
| 111 | * credentials were approved or not: |
| 112 | * |
| 113 | * Example: |
| 114 | * app.use(basicAuth({ authorizer })) |
| 115 | * |
| 116 | * function myAuthorizer(username: string, password: string) { |
| 117 | * return username.startsWith('A') && password.startsWith('secret'); |
| 118 | * } |
| 119 | * |
| 120 | * This will authorize all requests with credentials where the username begins with 'A' and the password begins |
| 121 | * with 'secret'. In an actual application you would likely look up some data instead ;-) |
| 122 | */ |
| 123 | authorizer: Authorizer |
| 124 | } |
| 125 | |
| 126 | interface IAsyncAuthorizerOptions extends IBaseOptions { |
| 127 | /** |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…