User Authentication System (UAS)
Requirements
The system provides a user name/password dialog that allows end users to authenticate
themselves. It also provides a security log UI which lets staff monitor potential
security threats (such as password guessing programs) by viewing failed login
attempts.
Scenario
- User enters "zorf" for User name and "xyzzy" for password.
- System displays "zorf" in User name field and ***** in the Password
field.
- User hits Enter while in the Password field.
- System checks for authorization; in this scenario, the authorization check
fails.
- System displays an error message dialog indicating that the login failed.
- System logs the failed login attempt.
- User clicks OK to dismiss the error dialog.
Design
The UI consists of two independent top-level windows (in a real system, the
windows would be on different displays or perhaps even different computers --
we will ignore these minor details). The system consists of three main classes,
one each for the two main UI components and a manager class:
- SecuritySystem - Manages other objects, performs authorization check.
- PasswordPopup - End user UI window, collects username and password and checks
for authorization with SecuritySystem.
- LogMonitor - Internal security UI window, displays interesting security-related
events.
Class Diagram
Left as an exercise. (See code below; reverse engineer the class diagram from
the Java code below.)
Implementation
System Documentation (javadoc)
Code: SecuritySystem.java
Code: PasswordPopup.java
Code: LogMonitor.java
Output