Skip to content

Commit

Permalink
docs(docs): update README.md file
Browse files Browse the repository at this point in the history
256
  • Loading branch information
rashisf committed Jan 8, 2025
1 parent 2e1f22b commit 160724b
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2978,6 +2978,44 @@ this.component(AuthenticationComponent);
This binding needs to be done before adding the Authentication component to your application.
Apart from this all other steps for authentication for all strategies remain the same.

### Custom Sequence Support

You can also configure `ClientAuthenticationMiddlewareProvider` and `UserAuthenticationMiddlewareProvider` options, which can be invoked using a custom sequence. See the sample below.

```ts title="custom-sequence.ts"
export class CustomSequence implements SequenceHandler {
@inject(SequenceActions.INVOKE_MIDDLEWARE, {optional: true})
protected invokeMiddleware: InvokeMiddleware = () => false;
...

async handle(context: RequestContext) {
...
...
// call custom registered middlewares in the pre-invoke chain
let finished = await this.invokeMiddleware(context, {
chain: CustomMiddlewareChain.PRE_INVOKE,
});
if (finished) return;
const result = await this.invoke(route, args);
this.send(response, result);
...
}
}
```

application.ts

```ts title="application.ts"
import {ClientAuthenticationMiddlewareProvider} from 'loopback4-authentication';
...
...
//
this.middleware(ClientAuthenticationMiddlewareProvider, {
chain: CustomMiddlwareChain.PRE_INVOKE
});

```

### Passport Auth0

In order to use it, run `npm install passport-auth0` and `npm install @types/passport-auth0`.
Expand Down

0 comments on commit 160724b

Please sign in to comment.