You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* When adopting a pre-existing shareable config it is important to understand that these
82
+
- When adopting a pre-existing shareable config it is important to understand that these
82
83
configs can change over time. Include time in your regular workflow to review these changes
83
84
and update your code base appropriately.
84
85
85
-
* Configure hooks to run eslint before committing code, but ensure that this pre-commit check does not take too long to execute which may cause complaints from developers.
86
-
* Use [husky](https://github.com/typicode/husky) to configure scripts to run before git commits and git pushes.
87
-
* These checks can be skipped by a developer when needed via `git commit --no-verify`
88
-
* Use [lint-staged](https://github.com/okonet/lint-staged) to reduce amount of code to be linted. This speeds up linting step before commit/push.
89
-
These can be integrated into package.json as follows:
86
+
- Configure hooks to run eslint before committing code, but ensure that this pre-commit check does not take too long to execute which may cause complaints from developers.
87
+
88
+
- Use [husky](https://github.com/typicode/husky) to configure scripts to run before git commits and git pushes.
89
+
- These checks can be skipped by a developer when needed via `git commit --no-verify`
90
+
- Use [lint-staged](https://github.com/okonet/lint-staged) to reduce amount of code to be linted. This speeds up linting step before commit/push.
91
+
These can be integrated into package.json as follows:
90
92
91
93
```json
92
94
"lint-staged": {
@@ -99,5 +101,4 @@ These can be integrated into package.json as follows:
99
101
}
100
102
```
101
103
102
-
* Always ensure CI/CD is running linting regardless of hooks.
103
-
104
+
- Always ensure CI/CD is running linting regardless of hooks.
Copy file name to clipboardExpand all lines: docs/functional-components/auth.md
+22-22Lines changed: 22 additions & 22 deletions
Original file line number
Diff line number
Diff line change
@@ -2,53 +2,53 @@
2
2
3
3
## Recommended Components
4
4
5
-
* Passport - http://www.passportjs.org/
5
+
- Passport - http://www.passportjs.org/
6
6
Passport is authentication middleware for Node.js. Extremely flexible and modular, Passport can be unobtrusively dropped in to any Express-based web application. Is based on strategies which allows for a large number of integrations.
7
7
8
-
* HelmetJS - https://helmetjs.github.io/
8
+
- HelmetJS - https://helmetjs.github.io/
9
9
Helmet helps you secure your Express apps by setting various HTTP headers. It’s not a silver bullet, but it can help!
10
10
11
-
* IBM Cloud AppID https://cloud.ibm.com/docs/services/appid
11
+
- IBM Cloud AppID https://cloud.ibm.com/docs/services/appid
12
12
App ID helps developers to easily add authentication to their web and mobile apps with few lines of code, and secure their Cloud-native applications and services on IBM Cloud.
13
13
14
-
* Istio - https://istio.io/
14
+
- Istio - https://istio.io/
15
15
Istio provides a service mesh, includes security features https://istio.io/docs/tasks/security/
16
16
IBM provides an Istio Adapter for App Identity and Access https://istio.io/docs/reference/config/policy-and-telemetry/adapters/app-identity-access-adapter/
17
17
18
18
## Guidance
19
19
20
-
* Use Helmet to configure http headers to address security attacks.
20
+
- Use Helmet to configure http headers to address security attacks.
21
21
22
-
* Use Passport to handle your web strategy
22
+
- Use Passport to handle your web strategy
23
23
24
-
* Use a web strategy based on AppID whenever possible.
24
+
- Use a web strategy based on AppID whenever possible.
25
25
26
-
* There is a difference between a WebApp/BFF(Backend for Frontend) and a pure Backend API that never deals with a Frontend like a Web Browser. Knowning this difference will help you understand the requirements in terms of security.
26
+
- There is a difference between a WebApp/BFF(Backend for Frontend) and a pure Backend API that never deals with a Frontend like a Web Browser. Knowning this difference will help you understand the requirements in terms of security.
27
27
28
-
* A Frontend WebApp should never handle end user credentials such as username/password, it should always delegate to an Authorization Server for example AppID service. https://github.com/ibm-cloud-security/appid-video-tutorials/blob/master/02a-simple-node-web-app/app.js
28
+
- A Frontend WebApp should never handle end user credentials such as username/password, it should always delegate to an Authorization Server for example AppID service. https://github.com/ibm-cloud-security/appid-video-tutorials/blob/master/02a-simple-node-web-app/app.js
29
29
30
-
* A pure Backend API that never deals with a fronted should never be concern of redirecting or dealing with end users, they would require an access/AOI token or assume the proxy/gateway in front is already handling this and not require token at all. https://github.com/ibm-cloud-security/appid-video-tutorials/blob/master/02b-simple-node-backend-app/app.js
30
+
- A pure Backend API that never deals with a fronted should never be concern of redirecting or dealing with end users, they would require an access/AOI token or assume the proxy/gateway in front is already handling this and not require token at all. https://github.com/ibm-cloud-security/appid-video-tutorials/blob/master/02b-simple-node-backend-app/app.js
31
31
32
-
* The browser/client should never have access to access token.
32
+
- The browser/client should never have access to access token.
33
33
34
-
* The Authorization Server will interact with the user and once is authenticated it will return to the browser with a grant code, which in turn can be used by the Web App request an access token. With this access token the WebApp can access a Backend API for a resource.
34
+
- The Authorization Server will interact with the user and once is authenticated it will return to the browser with a grant code, which in turn can be used by the Web App request an access token. With this access token the WebApp can access a Backend API for a resource.
35
35
36
-
* Use the refresh token whenever possible, this avoids re-authentication.
36
+
- Use the refresh token whenever possible, this avoids re-authentication.
37
37
38
-
* Do not use OAUTH2 implicit grant, is preferred to use Authorization code workflow.
38
+
- Do not use OAUTH2 implicit grant, is preferred to use Authorization code workflow.
39
39
40
-
* Use OIDC ID token for authentication, they are represented as JSON Web Token (JWT) and it contains the requested claims.
40
+
- Use OIDC ID token for authentication, they are represented as JSON Web Token (JWT) and it contains the requested claims.
41
41
42
-
* When using Istio:
43
-
* Istio Adapter for AppID can handle the authentication and authorization of the client, this leaves the nodejs service without the responsibilities of handling authentication or authorization. https://github.com/ibm-cloud-security/app-identity-and-access-adapter
42
+
- When using Istio:
44
43
45
-
* Using Istio you can handle authorization based on roles for the nodejs service, for example all authenticated users can read data via http method GET, but only users with `role=admin` are allowed to write data via http method POST.
44
+
-Istio Adapter for AppID can handle the authentication and authorization of the client, this leaves the nodejs service without the responsibilities of handling authentication or authorization. https://github.com/ibm-cloud-security/app-identity-and-access-adapter
46
45
47
-
## Learning Resources
46
+
- Using Istio you can handle authorization based on roles for the nodejs service, for example all authenticated users can read data via http method GET, but only users with `role=admin` are allowed to write data via http method POST.
48
47
49
-
*[Technologies Under the Hood (OAuth2, OIDC, JWT, Bearer Token)](https://www.youtube.com/watch?v=ndlk-ZhKGXM&list=PLbAYXkuqwrX2WLQqR0LUtjT77d4hisvfK&index=2)
48
+
## Learning Resources
50
49
51
-
*[Protecting Node.js Web Applications with IBM Cloud App ID](https://www.youtube.com/watch?v=6roa1ZOvwtw&list=PLbAYXkuqwrX2WLQqR0LUtjT77d4hisvfK&index=3)
50
+
-[Technologies Under the Hood (OAuth2, OIDC, JWT, Bearer Token)](https://www.youtube.com/watch?v=ndlk-ZhKGXM&list=PLbAYXkuqwrX2WLQqR0LUtjT77d4hisvfK&index=2)
52
51
53
-
*[Protecting Node.js Backend Application with IBM Cloud App ID](https://www.youtube.com/watch?v=jJLSgkHpZwA&list=PLbAYXkuqwrX2WLQqR0LUtjT77d4hisvfK&index=4)
52
+
-[Protecting Node.js Web Applications with IBM Cloud App ID](https://www.youtube.com/watch?v=6roa1ZOvwtw&list=PLbAYXkuqwrX2WLQqR0LUtjT77d4hisvfK&index=3)
54
53
54
+
-[Protecting Node.js Backend Application with IBM Cloud App ID](https://www.youtube.com/watch?v=jJLSgkHpZwA&list=PLbAYXkuqwrX2WLQqR0LUtjT77d4hisvfK&index=4)
0 commit comments