First, it's important to understand two key concepts.
- ๐๐๐๐ต๐ผ๐ฟ๐ถ๐๐ฎ๐๐ถ๐ผ๐ป
- ๐๐๐๐ต๐ฒ๐ป๐๐ถ๐ฐ๐ฎ๐๐ถ๐ผ๐ป
They are similar but not the same.
Let's see how ?
Say you're a developer in a tech company.
Your company ID card is your ๐๐จ๐ง๐๐๐ก๐ง๐๐๐๐ง๐๐ข๐ก - it's your identity.
As a developer you're authorized to code push and deploy.
But you're not authorized to access mergers and acquisition data.
These rules about who has access to what is known as ๐๐จ๐ง๐๐ข๐ฅ๐๐ฆ๐๐ง๐๐ข๐ก (used for access control, permissions etc.)
Here's is a sweet nugget to remember it forever:
Since you've understood what AUTHORISATION is, you must also understand that
- Authentication and Authorisation go hand in hand.
- They are two independent concepts, yet you need them to work together for designing an effective ๐จ๐ฆ๐๐ฅ ๐ฆ๐๐ฆ๐ฆ๐๐ข๐ก ๐ ๐๐ก๐๐๐๐ ๐๐ก๐ง.
Now, let's see how to implement authentication and authorisation, and how tokens (JWTs) are useful.
A simple user session management service needs 2 things:
- who the user is : authentication
- do they have permissions to access the requested resource : authorisation
Now, to design a system where all its resources are accessible to everyone is pretty simple.
No permission control, no authorisation required.
Everybody has access to every resource in the system, think of public CDNs.
The difficulties arise when the response from the server is dynamic.
Meaning userA logged in should not have access to userB's data.
Please understand, since http is a stateless protocol the server won't remember who is the request is coming from.
To fix that, we need some sort of information ( unique token) with each request.
Using this token the server could easily identify the user.
There are two methods in which web applications manage and remember users (sessions),
In a distributed world the micro services need to be able to talk to each other.
For instance,
When you hit the โค๏ธ button, the reaction service(service A) talks to the notification service(service B), and I'm notified of your reaction.
How does micro services communicateโ
There are two ways a service instance A can communicate with another service instance B.
1. Synchronous 2. Asynchronous
Synchronous -
In synchronous messaging the client sends its request directly to the server, and waits for the response to arrive.
The Client is dependent on the response from the server to proceed with its other requests.
Are you struggling with "what should you do next ?"
-Thread-
Often times we get lost with no clear thoughts on what to do next.
Here is something that should help you breakout of that loop.
1 - Research your options:
- spend timed 30 minutes exploring options,
- see what you find exciting
- look into different programs and decide which one is the best fit for you
2 - Take the next steps:
- once you have decided on a program, take the necessary steps to apply
- devise a plan, a todo list, write it down
- writing it down helps you get back to it sooner