FileDocCategorySizeDatePackage
SecurityServiceImpl.javaAPI DocExample1255Thu Sep 02 14:16:20 BST 2004com.oreilly.strutsckbk.ch11

SecurityServiceImpl

public class SecurityServiceImpl extends Object implements SecurityService

Fields Summary
private org.apache.struts.webapp.example.UserDatabase
userDatabase
private static final Log
log
Constructors Summary
public SecurityServiceImpl(org.apache.struts.webapp.example.UserDatabase userDatabase)

		this.userDatabase = userDatabase;
	
Methods Summary
public org.apache.struts.webapp.example.Userauthenticate(Credentials credentials)

		User user;
        try {
            user = userDatabase.findUser(credentials.getName());
        } catch (ExpiredPasswordException e) {
            throw new AuthenticationException("Password has expired.",e);
        }
        if (user == null) throw new AuthenticationException("Authentication failed");		
		return user;