Security, Authentication, Authorization and SSL
Authentication vs. Authorization
In simple terms,
authentication is the process of verifying who a user is
, orthe user proving who they are - using user id and password or some other way
authorization is the process of verifying what they have access to
, orensuring that the user is permitted to perform an action
Comparing these processes to a real-world example, when you go through security in an airport, you show your ID to authenticate your identity. Then, when you arrive at the gate, you present your boarding pass to the flight attendant, so they can authorize you to board your flight and allow access to the plane.
Authentication | Authorization |
---|---|
Determines whether users are who they claim to be | Determines what users can and cannot access |
Challenges the user to validate credentials (for example, through passwords, biometrics, authentication apps, one-time pins, answers to security questions) | Verifies whether access is allowed through policies and rules |
Usually done before authorization | Usually done after successful authentication |
Generally, transmits info through an ID Tokens | Generally, transmits info through an Access Tokens |
Generally governed by the OpenID Connect (OIDC) protocol | Generally governed by the OAuth 2.0 framework |
Example: Employees in a company are required to authenticate through the network before accessing their company email | Example: After an employee successfully authenticates, the system determines what information the employees are allowed to access |
Different ways
Keycloak authorization server -
- to secure the communication between services
- Identity and Access management
- Single Sign-on
OAuth2
- Delegated authorization with access token
OpenID Connect
- Authentication with ID Token
Bearer Tokens
- https://swagger.io/docs/specification/authentication/bearer-authentication/
- https://oauth.net/2/bearer-tokens/#
It means that the Bearer of this token is granted access. It means that anybody that has access to this access_token, has access to the API (and so, the data). There is no further authorization within a Bearer token. They are considered secure because of the fact that they are valid only for a limited time. If someone gets a hold of a Bearer token and they can use it, they can use it only for one hour before it expires.
Reading material
- https://www.keycloak.org/docs/latest/authorization_services/index.html
- https://auth0.com/docs/get-started/identity-fundamentals/authentication-and-authorization