Skip to content

Commit 99e0b2f

Browse files
RaghavaroraSFKarunesh Mani Tripathi
andauthored
fix(component): make passport packages optional (#156)
* fix(component): make passport packages optional All passport packages are made optional, and the user should install them only if required. BREAKING CHANGE: change import path for specific passport strategies GH-125 BREAKING CHANGE: rebased with master * fix(component): allpassport packages made optional All passport packages are made optional, and the user should install them only if required. BREAKING CHANGE: changes for seprating passport packages GH-125 * fix(component): added description in readme added description in readme GH-125 * fix(chore): sonar issue fix fix for Unexpected lexical declaration in case block GH-125 * fix(chore): fixed sonar issue fixed sonar issue Refactor this function to reduce its Cognitive Complexity GH-125 * fix(chore): fixed sonar issue fixed sonar issue replace this union type with a type alias. GH-125 * fix(chore): fixed sonar issue disabled sonar issue for Promise returned in function argument where a void return was expected GH-125 * fix(chore): sonar fixes sonar fixes GH-125 * fix(chore): fixed sonar issues fixed sonar issues GH-125 * fix(chore): fixed sonar issue fixed sonar issue GH-125 * fix(chore): fixed sonar issue fixed sonar issue GH-125 * fix(chore): code review comment fix code review comment fix GH-125 --------- Co-authored-by: Karunesh Mani Tripathi <karunesh@sourcefuse.com>
1 parent c6a899d commit 99e0b2f

File tree

48 files changed

+2354
-3322
lines changed

Some content is hidden

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

48 files changed

+2354
-3322
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ logs
44
npm-debug.log*
55
yarn-debug.log*
66
yarn-error.log*
7-
7+
.history/
88
# Runtime data
99
pids
1010
*.pid

.vscode/settings.json

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
{
2-
"editor.rulers": [80],
2+
"editor.rulers": [
3+
80
4+
],
35
"editor.tabCompletion": "on",
46
"editor.tabSize": 2,
57
"editor.trimAutoWhitespace": true,
68
"editor.formatOnSave": true,
7-
89
"sonarlint.connectedMode.project": {
910
"serverId": "sf_sonar",
1011
"projectKey": "sourcefuse_loopback4-authentication"
1112
},
12-
1313
"files.exclude": {
1414
"**/.DS_Store": true,
1515
"**/.git": true,
@@ -20,6 +20,10 @@
2020
},
2121
"files.insertFinalNewline": true,
2222
"files.trimTrailingWhitespace": true,
23-
24-
"typescript.tsdk": "./node_modules/typescript/lib"
23+
"typescript.tsdk": "./node_modules/typescript/lib",
24+
"cSpell.words": [
25+
"insta",
26+
"keycloack",
27+
"keycloak"
28+
]
2529
}

README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ Once this is done, you are ready to configure any of the available strategy in t
8181

8282
### Oauth2-client-password
8383

84+
In order to use it, run `npm install passport-oauth2-client-password`.
8485
First, create an AuthClient model implementing the IAuthClient interface. The purpose of this model is to store oauth registered clients for the app in the DB. See sample below.
8586

8687
```ts
@@ -243,6 +244,7 @@ For accessing the authenticated AuthClient model reference, you can inject the C
243244

244245
### Http-bearer
245246

247+
In order to use it, run `npm install passport-http-bearer`.
246248
First, create a AuthUser model implementing the IAuthUser interface. You can implement the interface in the user model itself. See sample below.
247249

248250
```ts
@@ -423,6 +425,7 @@ For accessing the authenticated AuthUser model reference, you can inject the CUR
423425

424426
### local
425427

428+
In order to use it, run `npm install passport-local`.
426429
First, create a AuthUser model implementing the IAuthUser interface. You can implement the interface in the user model itself. See sample below.
427430

428431
```ts
@@ -597,6 +600,7 @@ For accessing the authenticated AuthUser model reference, you can inject the CUR
597600

598601
### Oauth2-resource-owner-password
599602

603+
In order to use it, run `npm install passport-oauth2-resource-owner-password`.
600604
First, create an AuthClient model implementing the IAuthClient interface. The purpose of this model is to store oauth registered clients for the app in the DB. See sample below.
601605

602606
```ts
@@ -1018,6 +1022,7 @@ For accessing the authenticated AuthUser model reference, you can inject the CUR
10181022

10191023
### Google Oauth 2
10201024

1025+
In order to use it, run `npm install passport-google-oauth20` and `npm install @types/passport-google-oauth20`.
10211026
First, create a AuthUser model implementing the IAuthUser interface. You can implement the interface in the user model itself. See sample below.
10221027

10231028
```ts
@@ -1174,6 +1179,18 @@ this.bind(Strategies.Passport.GOOGLE_OAUTH2_VERIFIER).toProvider(
11741179
);
11751180
```
11761181

1182+
Now, bind this provider to the application in application.ts.
1183+
1184+
```ts
1185+
import { GoogleAuthStrategyFactoryProvider } from 'loopback4-authentication/passport-google-oauth2';
1186+
```
1187+
1188+
```ts
1189+
this.bind(Strategies.Passport.GOOGLE_OAUTH2_STRATEGY_FACTORY.key).toProvider(
1190+
GoogleAuthStrategyFactoryProvider
1191+
);
1192+
```
1193+
11771194
Finally, add the authenticate function as a sequence action to sequence.ts.
11781195

11791196
```ts
@@ -1331,6 +1348,7 @@ For accessing the authenticated AuthUser model reference, you can inject the CUR
13311348

13321349
### Instagram Oauth 2
13331350

1351+
In order to use it, run `npm install passport-instagram`.
13341352
First, create a AuthUser model implementing the IAuthUser interface. You can implement the interface in the user model itself. See sample below.
13351353

13361354
```ts
@@ -1642,6 +1660,7 @@ For accessing the authenticated AuthUser model reference, you can inject the CUR
16421660

16431661
### Apple Oauth 2
16441662

1663+
In order to use it, run `npm install --save passport-apple`.
16451664
First, create a AuthUser model implementing the IAuthUser interface. You can implement the interface in the user model itself. See sample below.
16461665

16471666
```ts
@@ -1955,6 +1974,7 @@ For accessing the authenticated AuthUser model reference, you can inject the CUR
19551974

19561975
### Facebook Oauth 2
19571976

1977+
In order to use it, run `npm install passport-facebook`.
19581978
First, create a AuthUser model implementing the IAuthUser interface. You can implement the interface in the user model itself. See sample below.
19591979

19601980
```ts
@@ -2266,6 +2286,7 @@ For accessing the authenticated AuthUser model reference, you can inject the CUR
22662286

22672287
### Keycloak
22682288

2289+
In order to use it, run `npm install @exlinc/keycloak-passport`.
22692290
First, create a AuthUser model implementing the IAuthUser interface. You can implement the interface in the user model itself. See sample below.
22702291

22712292
```ts
@@ -2608,6 +2629,7 @@ this.bind(VerifyBindings.BEARER_SIGNUP_VERIFY_PROVIDER).toProvider(
26082629

26092630
### SAML
26102631

2632+
In order to use it, run `npm install @node-saml/passport-saml`.
26112633
SAML (Security Assertion Markup Language) is an XML-based standard for exchanging authentication and authorization data between parties, in particular, between an identity provider (IdP) and a service provider (SP).
26122634

26132635
First, create a AuthUser model implementing the IAuthUser interface. You can implement the interface in the user model itself. See sample below.

0 commit comments

Comments
 (0)