FileDocCategorySizeDatePackage
SecurityService.javaAPI DocExample1286Sun Aug 15 20:14:44 BST 2004com.oreilly.strutsckbk.ch09

SecurityService

public class SecurityService extends Object
author
Bill Siggelkow TODO To change the template for this generated type comment go to Window - Preferences - Java - Code Style - Code Templates

Fields Summary
private static Map
users
Constructors Summary
Methods Summary
public voidadd(User user)

        if (users.containsKey(user.getUsername())) throw new DuplicateUsernameException();
        users.put(user.getUsername(),user.getPassword());
    
public voidauthenticate(java.lang.String username, java.lang.String password)

        if (users.get(username) == null) { 
            throw new UnknownUserException();
        } else if (!users.get(username).equals(password)) {
            throw new PasswordMatchException();
        }
        return;