Skip to content

Commit

Permalink
doc: Fix customAuthenticationProvider documentation (#1683)
Browse files Browse the repository at this point in the history
  • Loading branch information
petetnt committed Sep 24, 2023
1 parent 5a04d02 commit b9c0b58
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -524,9 +524,16 @@ only enabled with the `--ignoreJWTSignature` flag. Make sure to only set this fl

### Serverless plugin authorizers

If your authentication needs are custom and not satisfied by the existing capabilities of the Serverless offline project, you can inject your own authentication strategy. To inject a custom strategy for Lambda invocation, you define a custom variable under `serverless-offline` called `authenticationProvider` in the serverless.yml file. The value of the custom variable will be used to `require(your authenticationProvider value)` where the location is expected to return a function with the following signature.
If your authentication needs are custom and not satisfied by the existing capabilities of the Serverless offline project, you can inject your own authentication strategy. To inject a custom strategy for Lambda invocation, you define a custom variable under `offline` called `customAuthenticationProvider` in the serverless.yml file. The value of the custom variable will be used to `require(your customAuthenticationProvider value)` where the location is expected to return a function with the following signature.

```yaml
offline:
customAuthenticationProvider: ./path/to/custom-authentication-provider
```

```js
// ./path/to/customer-authentication-provider.js

module.exports = function (endpoint, functionKey, method, path) {
return {
getAuthenticateFunction() {
Expand All @@ -543,7 +550,7 @@ module.exports = function (endpoint, functionKey, method, path) {
}
```

A working example of injecting a custom authorization provider can be found in the projects integration tests under the folder `custom-authentication`.
A working example of injecting a custom authorization provider can be found in the projects integration tests under the folder [`custom-authentication`](./tests/integration/custom-authentication).

## Custom headers

Expand Down

0 comments on commit b9c0b58

Please sign in to comment.