Object-Oriented Programming · IBM · Medium
Design Authentication Manager – Solution We model an authentication system where each token has a fixed lifespan timeToLive (TTL). A token generated or renewed at time t is valid until t + timeToLive, and it is considered expired exactly at the expiration time (i.e., >= is expired, 2 (unexpired), so new expiry = 2+5 = 7. Map: {aaa: 7}. count 6 → scan map: aaa with 7 > 6, so count = 1. generate bbb 7 → expiry = 7+5 = 12. Map: {aaa: 7, bbb: 12}. renew aaa 8 → aaa exists with…
Checking your access…