FileDocCategorySizeDatePackage
MemorySecurityService.javaAPI DocExample981Mon Aug 23 16:30:04 BST 2004com.oreilly.strutsckbk.ch10

MemorySecurityService

public class MemorySecurityService extends Object implements SecurityService

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;