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
Copy file name to clipboardExpand all lines: module4-authentication-and-security/r1.3-authentication-persistence/README.md
+8-8Lines changed: 8 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -188,17 +188,17 @@ When the JWT is passed back to the server in the header, we check the claims, an
188
188
189
189
## Pros and Cons of JSON Web Tokens
190
190
191
-
JWTs are becoming more and more ubiquitous. Customer identity and access management (CIAM) providers everywhere are pushing JWTs as the silver bullet for everything. JWTs are pretty cool, but let’s talk about some of the downsides of JWTs and some of their strong benefits.
191
+
JWTs are becoming more and more ubiquitous. Customer identity and access management (CIAM) providers everywhere are pushing JWTs as the silver bullet for everything. JWTs are pretty cool, but let's talk about some of the downsides of JWTs and some of their strong benefits.
192
192
193
193
### PRO: JWTs are portable units of identity
194
194
195
-
That means they contain identity information as JSON and can be passed around to services and applications. Any service or application can verify a JWT itself. The service/application receiving a JWT doesn’t need to ask the identity provider that generated the JWT if it is valid or check any database for it. Once a JWT is verified, the service or application can use the data inside it to take action on behalf of the user. Plus, it works across different clients and domains.
195
+
That means they contain identity information as JSON and can be passed around to services and applications. Any service or application can verify a JWT itself. The service/application receiving a JWT doesn't need to ask the identity provider that generated the JWT if it is valid or check any database for it. Once a JWT is verified, the service or application can use the data inside it to take action on behalf of the user. Plus, it works across different clients and domains.
196
196
197
197
### PRO: Token-based Authentication is more Scalable and Efficient
198
198
199
199
Imagine your app has billions of users, and each of them creates a session. Eventually, the session storage will become pretty big and harder to maintain.
200
200
201
-
Tokens on the other hand are required to be stored on the user’s end, they offer a scalable solution.
201
+
Tokens on the other hand are required to be stored on the user's end, they offer a scalable solution.
202
202
203
203
Moreover, the server just needs to create and verify the tokens along with the information, which means that maintaining more users on a website or application at once is possible without any hassle.
204
204
@@ -212,9 +212,9 @@ This helps in encouraging more collaboration opportunities between enterprises a
212
212
213
213
Since tokens like JWT are stateless, only a secret key can validate it when received at a server-side application, which was used to create it.
214
214
215
-
Hence they’re considered the best and the most secure way of offering authentication.
215
+
Hence they're considered the best and the most secure way of offering authentication.
216
216
217
-
Tokens act as a storage for the user’s credentials and when the token travels between the server or the web browser, the stored credentials are never compromised.
217
+
Tokens act as a storage for the user's credentials and when the token travels between the server or the web browser, the stored credentials are never compromised.
218
218
219
219
### CON: Compromised Secret Key
220
220
@@ -238,13 +238,13 @@ To solve this problem, most applications use refresh tokens. Refresh tokens are
238
238
239
239
The overall size of a JWT is quite more than that of a normal session token, which makes it longer whenever more data is added to it.
240
240
241
-
So, if you’re adding more claims in the token, it will impact the overall loading speed and thus hamper the user experience.
241
+
So, if you're adding more claims in the token, it will impact the overall loading speed and thus hamper the user experience.
242
242
243
243
This situation can be fixed if the right development practices are followed and minimum but essential data is added to the JWT.
244
244
245
-
### CON: JWTs aren’t easily revocable
245
+
### CON: JWTs aren't easily revocable
246
246
247
-
This means that a JWT could be valid even though the user’s account has been suspended or deleted. Some solutions around this are available but they mostly require trips to the identity provider or the database, which JWT is essentially developed to minimize.
247
+
This means that a JWT could be valid even though the user's account has been suspended or deleted. Some solutions around this are available but they mostly require trips to the identity provider or the database, which JWT is essentially developed to minimize.
248
248
249
249
So if your app has the potential to deactivate or revoke user access frequently, think twice before using JWTs.
Copy file name to clipboardExpand all lines: module4-authentication-and-security/r1.5-authorization-through-middleware/README.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,7 +11,7 @@ This lesson objectives are:
11
11
12
12
## Middleware
13
13
14
-
Middleware are functions that have access to the [request object](https://expressjs.com/en/4x/api.html#req) (`req`), the [response object](https://expressjs.com/en/4x/api.html#res) (`res`), and the next middleware function in the application’s request-response cycle. The next middleware function is commonly denoted by a variable named `next`.
14
+
Middleware are functions that have access to the [request object](https://expressjs.com/en/4x/api.html#req) (`req`), the [response object](https://expressjs.com/en/4x/api.html#res) (`res`), and the next middleware function in the application's request-response cycle. The next middleware function is commonly denoted by a variable named `next`.
Usually, an error logging service like [sentry](https://sentry.io/) is also contacted in this middleware to log and track the error so you get notified when your app has run into an unhandled exception, with the required request-response details that can help the developers reproduce the error to fix it.
117
117
118
-
> ⚠️ **Warning**: Error-handling middleware always takes **four** arguments. You must provide four arguments to identify it as an error-handling middleware function. Even if you don’t need to use the next object, you must specify it to maintain the signature. Otherwise, the next object will be interpreted as regular middleware and will fail to handle errors.
118
+
> ⚠️ **Warning**: Error-handling middleware always takes **four** arguments. You must provide four arguments to identify it as an error-handling middleware function. Even if you don't need to use the next object, you must specify it to maintain the signature. Otherwise, the next object will be interpreted as regular middleware and will fail to handle errors.
Copy file name to clipboardExpand all lines: module4-authentication-and-security/r2-auth-schemes/README.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,16 +19,16 @@ Whenever users go to a domain that requires authentication, they are redirected
19
19
20
20
### How does SSO work?
21
21
22
-
SSO works based upon a trust relationship set up between an application, known as the service provider, and an identity provider, like [OneLogin](https://www.onelogin.com/) or [Auth0](https://auth0.com/). This trust relationship is often based upon a certificate that is exchanged between the identity provider and the service provider. This certificate can be used to sign identity information that is being sent from the identity provider to the service provider so that the service provider knows it is coming from a trusted source. In SSO, this identity data takes the form of JWTs which contain identifying bits of information about the user like a user’s email address or a username.
22
+
SSO works based upon a trust relationship set up between an application, known as the service provider, and an identity provider, like [OneLogin](https://www.onelogin.com/) or [Auth0](https://auth0.com/). This trust relationship is often based upon a certificate that is exchanged between the identity provider and the service provider. This certificate can be used to sign identity information that is being sent from the identity provider to the service provider so that the service provider knows it is coming from a trusted source. In SSO, this identity data takes the form of JWTs which contain identifying bits of information about the user like a user's email address or a username.
23
23
24
24
The login flow usually looks like this:
25
25
26
26
1. A user browses to the application or website they want access to, aka, the Service Provider.
27
27
2. The Service Provider sends a token that contains some information about the user, like their email address, to the SSO system, aka, the Identity Provider, as part of a request to authenticate the user.
28
28
3. The Identity Provider first checks to see whether the user has already been authenticated, in which case it will grant the user access to the Service Provider application and skip to step 5.
29
-
4. If the user hasn’t logged in, they will be prompted to do so by providing the credentials required by the Identity Provider. This could simply be a username and password or it might include some other form of authentication like a One-Time Password (OTP).
29
+
4. If the user hasn't logged in, they will be prompted to do so by providing the credentials required by the Identity Provider. This could simply be a username and password or it might include some other form of authentication like a One-Time Password (OTP).
30
30
5. Once the Identity Provider validates the credentials provided, it will send a token back to the Service Provider confirming a successful authentication.
31
-
6. This token is passed through the user’s browser to the Service Provider.
31
+
6. This token is passed through the user's browser to the Service Provider.
32
32
7. The token that is received by the Service Provider is validated according to the trust relationship that was set up between the Service Provider and the Identity Provider during the initial configuration.
33
33
8. The user is granted access to the Service Provider.
34
34
@@ -176,7 +176,7 @@ This scheme was prominent in many apps, like asking for your bank username and p
_Image rights belong to [Okta Developers](https://developer.okta.com/blog/2019/10/21/illustrated-guide-to-oauth-and-oidc)_
178
178
179
-
You should never be required to share your username and password, your credentials, to another service. There’s no guarantee that an organization will keep your credentials safe, or guarantee their service won’t access more of your personal information than necessary. It might sound crazy, but some applications still try to get away with this!
179
+
You should never be required to share your username and password, your credentials, to another service. There's no guarantee that an organization will keep your credentials safe, or guarantee their service won't access more of your personal information than necessary. It might sound crazy, but some applications still try to get away with this!
180
180
181
181
To the rescue comes OAuth, an agreed-upon standard to securely allow one service to access data from another.
Copy file name to clipboardExpand all lines: module4-authentication-and-security/r3-other-security-vulnerabilities-practices/README.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,7 +13,7 @@ In this lesson you will learn about:
13
13
14
14
## Cross-site request forgery (CSRF)
15
15
16
-
[CSRF](https://cheatsheetseries.owasp.org/cheatsheets/Cross-Site_Request_Forgery_Prevention_Cheat_Sheet.html) is an attack that forces an end user to execute unwanted actions on a web application in which they’re currently authenticated. With a little help of social engineering (such as sending a link via email or chat), an attacker may trick the users of a web application into executing actions of the attacker’s choosing. If the victim is a normal user, a successful CSRF attack can force the user to perform state changing requests like transferring funds, changing their email address, and so forth. If the victim is an administrative account, CSRF can compromise the entire web application.
16
+
[CSRF](https://cheatsheetseries.owasp.org/cheatsheets/Cross-Site_Request_Forgery_Prevention_Cheat_Sheet.html) is an attack that forces an end user to execute unwanted actions on a web application in which they're currently authenticated. With a little help of social engineering (such as sending a link via email or chat), an attacker may trick the users of a web application into executing actions of the attacker's choosing. If the victim is a normal user, a successful CSRF attack can force the user to perform state changing requests like transferring funds, changing their email address, and so forth. If the victim is an administrative account, CSRF can compromise the entire web application.
Copy file name to clipboardExpand all lines: module5-testing/r1.1-testing-philosphy/README.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -61,7 +61,7 @@ issues; test-driven development aids greatly with this mindset, since it
61
61
encourages you to write the test and think about these scenarios before writing
62
62
the code.
63
63
64
-
[Behaviour-driven development](https://en.wikipedia.org/wiki/Behavior-driven_development) or BDD is a concept that emerged from TDD. In BDD, tests are more user-focused and based on the system’s behavior. [Mocha](https://mochajs.org/) is a popular JavaScript framework for writing behaviour-driven tests. You've seen it in practice in the tests for your assignments. BDD usually follows the "Given-When-Then" formula.
64
+
[Behaviour-driven development](https://en.wikipedia.org/wiki/Behavior-driven_development) or BDD is a concept that emerged from TDD. In BDD, tests are more user-focused and based on the system's behavior. [Mocha](https://mochajs.org/) is a popular JavaScript framework for writing behaviour-driven tests. You've seen it in practice in the tests for your assignments. BDD usually follows the "Given-When-Then" formula.
Copy file name to clipboardExpand all lines: module5-testing/r2.1-testing-examples/README.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -62,7 +62,7 @@ What is the difference between testing the controller and testing the route? Whe
62
62
63
63
As the name suggests, middleware is a piece of code that executes between the input and output of a request-response lifecycle. These can be helper functions or external libraries that perform an operation on your API request before the actual controller starts operating on it.
64
64
65
-
In practice, an Express application is essentially a series of middleware function calls. In Express, middleware functions are functions that have access to the request object (req), the response object (res), and the next middleware function in the application’s request-response cycle.
65
+
In practice, an Express application is essentially a series of middleware function calls. In Express, middleware functions are functions that have access to the request object (req), the response object (res), and the next middleware function in the application's request-response cycle.
66
66
67
67
Middleware functions can perform the following tasks:
0 commit comments