Skip to content

Commit 0e470f8

Browse files
feat(middleware): add client and user authentication middleware (#90)
GH-32
1 parent eac49cc commit 0e470f8

File tree

298 files changed

+1924
-5052
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

298 files changed

+1924
-5052
lines changed

.cz-config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ module.exports = {
3030
{name: 'component'},
3131
{name: 'provider'},
3232
{name: 'core'},
33+
{name: 'middleware'},
3334
],
3435

3536
appendBranchNameToCommitMessage: true,

.vscode/launch.json

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"program": "${workspaceFolder}\\index.js",
1212
"outFiles": [
1313
"${workspaceFolder}/**/*.js"
14-
]
14+
],
1515
},
1616
{
1717
"type": "node",
@@ -25,7 +25,20 @@
2525
"${workspaceFolder}\\dist\\__tests__"
2626
],
2727
"console": "integratedTerminal",
28-
"internalConsoleOptions": "neverOpen"
28+
"internalConsoleOptions": "neverOpen",
29+
},
30+
{
31+
"name": "Run mocha",
32+
// Type of configuration. Possible values: "node", "mono".
33+
"type": "node",
34+
// Workspace relative or absolute path to the program.
35+
"program": "${workspaceRoot}/node_modules/.bin/lb-mocha",
36+
// Automatically stop program after launch.
37+
"stopOnEntry": false,
38+
// Command line arguments passed to the program.
39+
"args": ["--allow-console-logs","\"${workspaceRoot}/dist/__tests__\"","-g","\"should return 200 when client id is passed and passReqToCallback is set true\""],
40+
// Workspace relative or absolute path to the working directory of the program being debugged. Default is the current workspace.
41+
"cwd": ".",
2942
}
3043
]
3144
}

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2550,6 +2550,22 @@ this.bind(VerifyBindings.BEARER_SIGNUP_VERIFY_PROVIDER).toProvider(
25502550

25512551
If a https proxy agent is needed for keycloak and google auth, just add an environment variable named `HTTPS_PROXY` or `https_proxy` with proxy url as value. It will add that proxy agent to the request.
25522552

2553+
## Middleware Sequence Support
2554+
2555+
As action based sequence will be deprecated soon, we have provided support for middleware based sequences. If you are using middleware sequence you can add authentication to your application by enabling client or user authentication middleware. This can be done by binding the AuthenticationBindings.CONFIG :
2556+
2557+
```ts
2558+
this.bind(AuthenticationBindings.CONFIG).to({
2559+
useClientAuthenticationMiddleware: true,
2560+
useUserAuthenticationMiddleware: true,
2561+
});
2562+
2563+
this.component(AuthenticationComponent);
2564+
```
2565+
2566+
This binding needs to be done before adding the Authentication component to your application.
2567+
Apart from this all other steps for authentication for all strategies remain the same.
2568+
25532569
## Feedback
25542570

25552571
If you've noticed a bug or have a question or have a feature request, [search the issue tracker](https://github.com/sourcefuse/loopback4-authentication/issues) to see if someone else in the community has already created a ticket.

dist/__tests__/fixtures/data/bearer-data.d.ts

Lines changed: 0 additions & 4 deletions
This file was deleted.

dist/__tests__/fixtures/data/bearer-data.js

Lines changed: 0 additions & 15 deletions
This file was deleted.

dist/__tests__/fixtures/data/bearer-data.js.map

Lines changed: 0 additions & 1 deletion
This file was deleted.

dist/__tests__/fixtures/providers/azuread-auth.provider.d.ts

Lines changed: 0 additions & 6 deletions
This file was deleted.

dist/__tests__/fixtures/providers/azuread-auth.provider.js

Lines changed: 0 additions & 18 deletions
This file was deleted.

dist/__tests__/fixtures/providers/azuread-auth.provider.js.map

Lines changed: 0 additions & 1 deletion
This file was deleted.

dist/__tests__/fixtures/providers/bearer-passport.provider.d.ts

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)