Test role access and inspect the audit log
Compare admin, guest, disabled, and unknown cards against zone permissions and verify the audit reason for each decision.

Shield Shelly: I want you to check who was recognized, what was allowed, and which audit entry proves it.
Predict the reading, then compare it with the measurement.
Wokwi ESP32
Third party ToolCompare admin, guest, disabled, and unknown cards against zone permissions and verify the audit reason for each decision.
Open the ESP32 editor, paste diagram.json, then paste sketch.ino.
Open Wokwi to paste in the files (new tab)Get the files
Use both prepared files. This is a paste-in setup; saving a project requires a Wokwi account.
sketch.ino
- Use the launch button above to open the ESP32 editor in Wokwi.
- Select the editor’s diagram.json tab and replace all its text with the supplied diagram.json.
- Select the sketch.ino tab, replace all its text with the supplied sketch.ino, then click Start Simulation.
Steps
Step 1
- Do
- Paste diagram.json and sketch.ino into a new Wokwi ESP32 project; inspect the seven GPIO connections before starting.
- You will see
- Four LED paths use GPIO 2, 4, 5, and 18 with 220 Ω resistors; the buzzer uses 19 and the two buttons use 15 and 16.
- Why it matters
- A visible output must correspond to the authorization decision. The host chapter separates identity from the permission to act.

Step 1 · Wokwi ESP32; numbered callout added to a real capture. Enlarge screenshot (new tab) Step 2
- Do
- Start the simulation and open Serial Monitor at 115200 baud. Send STATUS followed by Enter.
- You will see
- The startup heading reads IoT ACCESS CONTROL SYSTEM v1.0; STATUS reports Locked: NO | Fails: 0 | Card: RFID_ADMIN_001.
- Why it matters
- The initial state makes later decisions reproducible. A known identity and a clear policy are separate inputs to access control.

Step 2 · Wokwi ESP32; numbered callout added to a real capture. Enlarge screenshot (new tab) Step 3
- Do
- Send CARD 0, then ZONE 2, each on its own line.
- You will see
- ACCESS GRANTED: Alice Admin -> Server Room appears; the green and blue LEDs illuminate briefly.
- Why it matters
- The admin role satisfies the server room’s ADMIN requirement. This is the host chapter’s role-based baseline in a small controller.
Server Room appears. The ring marks the admin grant." loading="lazy">Step 3 · Wokwi ESP32; numbered callout added to a real capture. Enlarge screenshot (new tab) Step 4
- Do
- Send CARD 2, then ZONE 2.
- You will see
- ACCESS DENIED: Eve Guest has GUEST, needs ADMIN appears and the red LED flashes three times.
- Why it matters
- Authentication can succeed while authorization fails. Recognizing the guest card does not give it an administrator’s permission.

Step 4 · Wokwi ESP32; numbered callout added to a real capture. Enlarge screenshot (new tab) Step 5
- Do
- Keep CARD 2 selected and send ZONE 0.
- You will see
- ACCESS GRANTED: Eve Guest -> Public Lobby appears and the green LED illuminates.
- Why it matters
- Least privilege allows the resource the role needs. A restricted identity can still have useful, explicitly scoped access.
Public Lobby appears. The ring marks the scoped guest grant." loading="lazy">Step 5 · Wokwi ESP32; numbered callout added to a real capture. Enlarge screenshot (new tab) Step 6
- Do
- Send CARD 3, then ZONE 1, and finally LOG.
- You will see
- The red LED flashes and the audit log contains ACCOUNT_DISABLED for Frank Former with FAIL.
- Why it matters
- Credential lifecycle matters as much as role level. The host explains why retired or disabled identities must lose access.

Step 6 · Wokwi ESP32; numbered callout added to a real capture. Enlarge screenshot (new tab) Step 7
- Do
- Send CARD 4 and then ZONE 2 three times, waiting for each red-flash sequence to finish.
- You will see
- The failure counter reaches AUTH FAILED: Unknown card (3/3), followed by !!! BRUTE FORCE LOCKOUT !!!.
- Why it matters
- The controller records unknown identity attempts separately from insufficient privileges. This is a teaching lockout, not the host’s full identity-provisioning system.

Step 7 · Wokwi ESP32; numbered callout added to a real capture. Enlarge screenshot (new tab) Step 8
- Do
- During lockout, send CARD 0 and ZONE 2; then send LOG and STATUS.
- You will see
- The request is BLOCKED despite the admin card; LOG includes ACCESS_BLOCKED and STATUS reports Locked: YES.
- Why it matters
- A gate can deny an otherwise permitted request. The host’s broader lesson is to explain the policy and context behind every decision.

Step 8 · Wokwi ESP32; numbered callout added to a real capture. Enlarge screenshot (new tab) Step 9
- Do
- Wait at least 60 simulated seconds for Lockout expired -- system unlocked.; send CARD 0 and ZONE 2 again.
- You will see
- The admin request is granted again. STATUS reports Locked: NO and Fails: 0.
- Why it matters
- Time and state change the result. This local cooldown illustrates contextual enforcement but does not implement a general ABAC engine.

Step 9 · Wokwi ESP32; numbered callout added to a real capture. Enlarge screenshot (new tab)
Chapter checks
These questions refer to the chapter’s examples. Use the return links to review their answers.
A new technician account is created in an IoT platform. Following least privilege, what should its initial access be?
Return to the chapter’s knowledge checkAn AWS IoT-style policy contains a broad statement that Allows publishing to all device topics and a separate statement that explicitly Denies publishing to another tenant's topics. A device tries to publish to another tenant's topic. What happens?
Return to the chapter’s knowledge check
Return to IoT Access Control: Models and Policy · Browse Labs