auth:ex2
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
auth:ex2 [2007/02/26 17:00] – created bdefrain | auth:ex2 [2021/02/05 13:47] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Authentication: | + | [[auth: |
+ | [[auth: | ||
+ | [[auth: | ||
+ | [[auth: | ||
+ | [[auth: | ||
+ | Extend your aspect to enforce an authenticated user when '' | ||
+ | |||
+ | To model the authentication, | ||
+ | |||
+ | The code to manage the current role for the user and to present the authentication dialog is shown here: | ||
+ | |||
+ | <code aspectj> | ||
+ | import javax.swing.JOptionPane; | ||
+ | import figures.annotations.Authenticated; | ||
+ | |||
+ | public aspect AccessControl { | ||
+ | ... | ||
+ | Authenticated.Role role; | ||
+ | |||
+ | public void authenticate() { | ||
+ | role = (Authenticated.Role) | ||
+ | JOptionPane.showInputDialog(null, | ||
+ | " | ||
+ | JOptionPane.INFORMATION_MESSAGE, | ||
+ | Authenticated.Role.values(), | ||
+ | } | ||
+ | ... | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | As long as the user is not authenticated, | ||
+ | |||
+ | <code aspectj> | ||
+ | while(role == null) | ||
+ | authenticate(); | ||
+ | </ | ||
+ | |||
+ | After implementing the aspect, run the figure editor. You should be presented with the authentication dialog upon drawing the first point. Afterwards, new points can be added without interruption. | ||
+ | |||
+ | ---- | ||
+ | |||
+ | Continue with [[auth: |
auth/ex2.1172505651.txt.gz · Last modified: 2007/02/26 17:00 by bdefrain