Skip to content

Commit 0ca6c14

Browse files
Added readme instructions for using custom verifier bindings (#28)
1 parent 84ed88f commit 0ca6c14

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1396,6 +1396,27 @@ For accessing the authenticated AuthUser model reference, you can inject the CUR
13961396
@inject.getter(AuthenticationBindings.CURRENT_USER)
13971397
private readonly getCurrentUser: Getter<User>,
13981398
```
1399+
### Custom Verifier for Individual Routes
1400+
1401+
For providing a custom verifier for a particular route, you can pass a binding key for a verifier provider as the fourth parameter of the authenticate decorator.
1402+
Note - The key VerifyBindings.BEARER_SIGNUP_VERIFY_PROVIDER can be any custom key, it just be bound to a verify function provider.
1403+
1404+
```ts
1405+
@authenticate(
1406+
STRATEGY.BEARER,
1407+
undefined, //options
1408+
undefined, //authOptions
1409+
VerifyBindings.BEARER_SIGNUP_VERIFY_PROVIDER,
1410+
)
1411+
```
1412+
1413+
And binding this key to a verifier in the application.ts
1414+
1415+
```ts
1416+
this.bind(VerifyBindings.BEARER_SIGNUP_VERIFY_PROVIDER).toProvider(
1417+
LocalPreSignupProvider as Constructor<Provider<PreSignupFn>>,
1418+
);
1419+
```
13991420

14001421
## Feedback
14011422

0 commit comments

Comments
 (0)