CSE Roadmap

Core tier · about 4 hours · 9 parts

Part 3 of 9 · 2 min read

Who you are, and what you may do

Two questions that are often confused.

BM separates two ideas. Authentication is confirming that a party is who it says it is. For a person it is often a username and password, or a fingerprint. The party being checked, person or program, is called the principal. Authorisation maps a principal to the actions it may take. After authentication, the system usually learns facts such as the person's department, which help decide what is allowed.

A door lock and a guest list show the difference. The lock checks the key (authentication). The list says which rooms you may enter (authorisation).

In a distributed system, nobody wants a separate login for each service. The aim is a single identity authenticated once. BM covers single sign-on (SSO). A principal who wants a resource is sent to an identity provider, which may ask for a password or a second factor. When satisfied, it tells the service provider enough to decide on access. The two main standards named are SAML (common in enterprises, complex, based on SOAP) and OpenID Connect (built on OAuth 2.0, simpler REST calls). Identity providers may link to a directory service such as LDAP or Active Directory that stores people and their roles.

Gateway. Rather than every service doing the handshake, a gateway can sit between the outside world and the services and do it once. It then passes the principal's details, such as username and roles, to services in headers. BM warns that putting all security in the gateway is a single point of failure, and that gateways tend to grow, becoming a coupling point with a larger attack surface.

Where to decide. A gateway can make coarse decisions, such as "only staff may use the helpdesk". Finer ones belong in the service. BM's example: a call-centre role may see everything about a customer except payment details, and may issue refunds up to a cap, while a team-leader role may issue larger ones. Those rules live in the service. BM warns against roles like "call centre, 50-dollar refund" held in the directory, which spreads one service's behaviour across systems. Prefer a few coarse-grained roles that match how the organisation works.

Authentication and authorisation

Authentication checks who a principal is. Authorisation decides what that principal may do.

Example: a valid login proves you are Dana (authentication). The refund service lets Dana refund up to 100 but not more (authorisation).

Check yourself: 1. Which of the two does a password login do? 2. Why use SSO in a system of many services? 3. Why keep fine-grained rules inside the service?