Four questions at the airport
At the airport, four things happen.
You show a passport: this says who you claim to be. A guard looks at your face: this checks it is really you. Your ticket opens one gate and not the staff door: this is what you may do. Cameras record everything: this shows who did what.
A computer system asks the same four questions.
Key words
| Word | What it means | Example |
|---|---|---|
| Identification | Saying who you are. | typing a username |
| Authentication | Proving you are who you said. | a password or a fingerprint |
| Authorisation | Deciding what you are allowed to do. | a student cannot edit marks |
| Accountability | Tracing every action back to a person. | a log of who changed a mark |
| Role | A job in the system with a set of rights. | teacher, student |
| Access control list | A list on a resource that says who may use it. | a list on a folder |
| Audit log | A record of who did what, and when. | Sam read marks at 9:03 |
| Biometric | Using a part of your body to identify you. | fingerprint, face |
The cells students fill in are left blank in this preview.
Quick check: which step?
Have a go
Quick check: which step?
3 questionsThe four steps
flowchart LR
i[1 Identification: who do you say you are?] --> a[2 Authentication: prove it]
a --> z[3 Authorisation: what may you do?]
z --> c[4 Accountability: who did what?]
Three kinds of proof
| Kind | Example | Benefit | Drawback |
|---|---|---|---|
| Something you know | Password, PIN | Easy. Costs nothing | Can be guessed or shared |
| Something you have | Staff card, phone, security key | Hard to copy from far away | Can be lost or stolen |
| Something you are | Fingerprint, face | Always with you. Hard to fake | Costs money. Raises privacy worries. You cannot change your fingerprint |
The cells students fill in are left blank in this preview.
Which step is it?
Have a go
Which step is it?
6 questionsStep 2: ways to authenticate
| Method | How it works | Benefit | Drawback |
|---|---|---|---|
| Password | A secret word you remember | Simple. Everyone knows how | Often weak. Often reused |
| Passphrase | A longer secret made of words | Long, so hard to crack. Easy to remember | Slower to type |
| Multi-factor (MFA) | Two or more different kinds of proof | A stolen password is not enough | Extra steps. A lost phone is a problem |
| Biometric | Your fingerprint or face is matched | Quick. Nothing to remember | Can reject you wrongly or accept the wrong person. Cannot be changed if copied |
The cells students fill in are left blank in this preview.
Step 3: what may you do?
After you are known, the system decides what you may do. This is authorisation.
Role-based access gives rights to a role. Everyone with the role gets the same rights. An access control list (ACL) is a list on one resource, such as a folder. It names who may use it.
Role-based access: an example
| Action | Student | Teacher | Administrator |
|---|---|---|---|
| Read marks | Yes (own only) | Yes | Yes |
| Edit marks | No | Yes | No |
| Add a new user | No | No | Yes |
| Read the audit log | No | No | Yes |
The cells students fill in are left blank in this preview.
Try it: a tiny login system
users = {"sam": "student", "khan": "teacher"}
permissions = {"student": ["read marks"], "teacher": ["read marks", "edit marks"]}
log = []
name = "sam"
action = "edit marks"
if name in users:
role = users[name]
allowed = action in permissions[role]
log.append([name, action, allowed])
print(allowed)
print(log)
# Change name to "khan" and run it again. Look at the log.
Make a free account to save your work and track your progress.
Step 4: who did what?
Accountability means every action can be traced to one person. An audit log records who did what, and when. This record of user activity includes logins, files opened and changes made.
This only works if each person has their own account. A shared login breaks it: nobody knows who did the action.
Your turn: build the four steps
Build the four steps of a small login system. Identify a user, check their password by its hash, decide what a role may do, and read the log of one person's actions. Press Run Tests.
import hashlib
def hash_of(text):
# This one is done for you. It gives back the hash of the text.
return hashlib.sha256(text.encode("utf-8")).hexdigest()
def identify(username, users):
# users is a dictionary: username -> a record with "hash" and "role".
# Identification: is this username known? Give back True or False.
return False
def authenticate(username, password, users):
# Authentication: does the hash of the password equal the stored hash? Use hash_of.
# An unknown username is always False.
return False
def authorise(role, action, role_permissions):
# Authorisation (role-based): role_permissions is role -> list of actions.
# An unknown role may do nothing.
return False
def actions_by(log, user):
# Accountability: log is a list of entries. Each entry is a list: [user, action].
# Give back the list of actions done by user, in order.
return []
Make a free account to save your work, or press Start lab to work through the whole lesson.
Scenario: what went wrong?
Have a go
Scenario: what went wrong?
4 questionsKey words crossword
Have a go
Loading…
Your answers are marked here and are not kept. A college account keeps every student’s marks.
Final check
Have a go
Final check
5 questionsRemember
Important
Identify: say who you are. Authenticate: prove it. Authorise: what may you do? Account: record who did what.