Easier to read with cream paper, a tint, more contrast or larger text? Choose your colours and text, once, for every page.

Free lesson

8.4 (2 of 2): Identify, authenticate, authorise, account

The whole lesson, free. Read it and have a go at the activities. To work the tasks and labs in the real lesson, press Start lab, with no account needed.

50 minutes

A quick check that you are not a bot, then your own lab opens on the interactive lesson.

Already have an account? Sign in

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

WordWhat it meansExample
IdentificationSaying who you are.typing a username
AuthenticationProving you are who you said.a password or a fingerprint
AuthorisationDeciding what you are allowed to do.a student cannot edit marks
AccountabilityTracing every action back to a person.a log of who changed a mark
RoleA job in the system with a set of rights.teacher, student
Access control listA list on a resource that says who may use it.a list on a folder
Audit logA record of who did what, and when.Sam read marks at 9:03
BiometricUsing 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 questions
Have a go: your answers are marked here and then forgotten. Sign in if you would like your score kept, and to pick up where you left off.Sign in to keep your score

The 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

KindExampleBenefitDrawback
Something you knowPassword, PINEasy. Costs nothingCan be guessed or shared
Something you haveStaff card, phone, security keyHard to copy from far awayCan be lost or stolen
Something you areFingerprint, faceAlways with you. Hard to fakeCosts 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 questions
Have a go: your answers are marked here and then forgotten. Sign in if you would like your score kept, and to pick up where you left off.Sign in to keep your score

Step 2: ways to authenticate

MethodHow it worksBenefitDrawback
PasswordA secret word you rememberSimple. Everyone knows howOften weak. Often reused
PassphraseA longer secret made of wordsLong, so hard to crack. Easy to rememberSlower to type
Multi-factor (MFA)Two or more different kinds of proofA stolen password is not enoughExtra steps. A lost phone is a problem
BiometricYour fingerprint or face is matchedQuick. Nothing to rememberCan 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

ActionStudentTeacherAdministrator
Read marksYes (own only)YesYes
Edit marksNoYesNo
Add a new userNoNoYes
Read the audit logNoNoYes

The cells students fill in are left blank in this preview.

Try it: a tiny login system

Code: python
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.

Code: python
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 questions
Have a go: your answers are marked here and then forgotten. Sign in if you would like your score kept, and to pick up where you left off.Sign in to keep your score

Key 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 questions
Have a go: your answers are marked here and then forgotten. Sign in if you would like your score kept, and to pick up where you left off.Sign in to keep your score

Remember

Important

Identify: say who you are. Authenticate: prove it. Authorise: what may you do? Account: record who did what.

Teach this lesson with your class

On a college account your students work the tasks and the labs as well, and every mark is kept for you.