Skip to content

Commit

Permalink
feat(middleware): add client and user authentication middleware (#90)
Browse files Browse the repository at this point in the history
  • Loading branch information
barleendhaliwal committed Sep 23, 2022
1 parent eac49cc commit 0e470f8
Show file tree
Hide file tree
Showing 298 changed files with 1,924 additions and 5,052 deletions.
1 change: 1 addition & 0 deletions .cz-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ module.exports = {
{name: 'component'},
{name: 'provider'},
{name: 'core'},
{name: 'middleware'},
],

appendBranchNameToCommitMessage: true,
Expand Down
17 changes: 15 additions & 2 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"program": "${workspaceFolder}\\index.js",
"outFiles": [
"${workspaceFolder}/**/*.js"
]
],
},
{
"type": "node",
Expand All @@ -25,7 +25,20 @@
"${workspaceFolder}\\dist\\__tests__"
],
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen"
"internalConsoleOptions": "neverOpen",
},
{
"name": "Run mocha",
// Type of configuration. Possible values: "node", "mono".
"type": "node",
// Workspace relative or absolute path to the program.
"program": "${workspaceRoot}/node_modules/.bin/lb-mocha",
// Automatically stop program after launch.
"stopOnEntry": false,
// Command line arguments passed to the program.
"args": ["--allow-console-logs","\"${workspaceRoot}/dist/__tests__\"","-g","\"should return 200 when client id is passed and passReqToCallback is set true\""],
// Workspace relative or absolute path to the working directory of the program being debugged. Default is the current workspace.
"cwd": ".",
}
]
}
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2550,6 +2550,22 @@ this.bind(VerifyBindings.BEARER_SIGNUP_VERIFY_PROVIDER).toProvider(

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.

## Middleware Sequence Support

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 :

```ts
this.bind(AuthenticationBindings.CONFIG).to({
useClientAuthenticationMiddleware: true,
useUserAuthenticationMiddleware: true,
});

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.

## Feedback

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.
Expand Down
4 changes: 0 additions & 4 deletions dist/__tests__/fixtures/data/bearer-data.d.ts

This file was deleted.

15 changes: 0 additions & 15 deletions dist/__tests__/fixtures/data/bearer-data.js

This file was deleted.

1 change: 0 additions & 1 deletion dist/__tests__/fixtures/data/bearer-data.js.map

This file was deleted.

6 changes: 0 additions & 6 deletions dist/__tests__/fixtures/providers/azuread-auth.provider.d.ts

This file was deleted.

18 changes: 0 additions & 18 deletions dist/__tests__/fixtures/providers/azuread-auth.provider.js

This file was deleted.

This file was deleted.

This file was deleted.

20 changes: 0 additions & 20 deletions dist/__tests__/fixtures/providers/bearer-passport.provider.js

This file was deleted.

This file was deleted.

6 changes: 0 additions & 6 deletions dist/__tests__/fixtures/providers/google-auth.provider.d.ts

This file was deleted.

18 changes: 0 additions & 18 deletions dist/__tests__/fixtures/providers/google-auth.provider.js

This file was deleted.

This file was deleted.

11 changes: 0 additions & 11 deletions dist/__tests__/fixtures/providers/instagram-auth.provider.d.ts

This file was deleted.

18 changes: 0 additions & 18 deletions dist/__tests__/fixtures/providers/instagram-auth.provider.js

This file was deleted.

This file was deleted.

This file was deleted.

24 changes: 0 additions & 24 deletions dist/__tests__/fixtures/providers/local-password.provider.js

This file was deleted.

This file was deleted.

This file was deleted.

20 changes: 0 additions & 20 deletions dist/__tests__/fixtures/providers/passport-client.provider.js

This file was deleted.

This file was deleted.

This file was deleted.

25 changes: 0 additions & 25 deletions dist/__tests__/fixtures/providers/resource-owner.provider.js

This file was deleted.

This file was deleted.

14 changes: 0 additions & 14 deletions dist/__tests__/fixtures/sequences/authentication.sequence.d.ts

This file was deleted.

53 changes: 0 additions & 53 deletions dist/__tests__/fixtures/sequences/authentication.sequence.js

This file was deleted.

0 comments on commit 0e470f8

Please sign in to comment.