001: /* CVS ID: $Id: Authenticator.java,v 1.1.1.1 2002/10/02 18:42:51 wastl Exp $ */
002: package net.wastl.webmail.server;
003:
004: import net.wastl.webmail.config.ConfigScheme;
005: import net.wastl.webmail.exceptions.*;
006:
007: import org.webengruven.webmail.auth.AuthDisplayMngr;
008:
009: /**
010: * Authenticator.java
011: *
012: * Created: Mon Apr 19 11:01:22 1999
013: *
014: * Copyright (C) 1999-2000 Sebastian Schaffert
015: *
016: * This program is free software; you can redistribute it and/or
017: * modify it under the terms of the GNU General Public License
018: * as published by the Free Software Foundation; either version 2
019: * of the License, or (at your option) any later version.
020: *
021: * This program is distributed in the hope that it will be useful,
022: * but WITHOUT ANY WARRANTY; without even the implied warranty of
023: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
024: * GNU General Public License for more details.
025: *
026: * You should have received a copy of the GNU General Public License
027: * along with this program; if not, write to the Free Software
028: * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
029: */
030: /**
031: * Generic class for user authentication.
032: * This class actually doesn't do anything.
033: *
034: * @author Sebastian Schaffert
035: * @version 1.0
036: * @see AuthenticatorHandler
037: * @see net.wastl.webmail.storage.simple.SimpleStorage
038: */
039: /* 9/24/2000 devink -- changed for challenge/response authentication */
040: public abstract class Authenticator {
041: protected String key;
042:
043: public Authenticator() {
044:
045: }
046:
047: public String getKey() {
048: return key;
049: }
050:
051: public abstract String getVersion();
052:
053: /** Get a displamanager object for this class.
054: * @see org.webengruven.webamil.auth.AuthDisplayMngr
055: * @return the AuthDisplayMngr apropriate for this class.
056: */
057: public AuthDisplayMngr getAuthDisplayMngr() {
058: return new AuthDisplayMngr();
059: }
060:
061: /**
062: * (Re-)Initialize this authenticator.
063: * Needed as we can't use the Constructor properly with the Plugin-style.
064: * @param parent Give the Storage to allow the authenticator to check
065: * certain things.
066: */
067: public abstract void init(Storage store);
068:
069: /**
070: * Register this authenticator with WebMail.
071: */
072: public abstract void register(ConfigScheme store);
073:
074: /**
075: * Authentication to be done *before* UserData is available.
076: * You may use a Unix login() for example to check whether a user is
077: * allowed to use WebMail in general
078: * Subclasses should override this.
079: * It simply does nothing in this implementation.
080: *
081: * @param login Login-name for the user
082: * @param domain Domain name the user used to log on
083: * @param passwd Password to verify
084: */
085: public void authenticatePreUserData(String login, String domain,
086: String passwd) throws InvalidPasswordException {
087: if (login.equals("") || passwd.equals("")) {
088: throw new InvalidPasswordException();
089: }
090: }
091:
092: /**
093: * Authentication with available UserData.
094: * This usually should just check the password saved by the user, but
095: * may also be empty if you trust the pre-authentication (perhaps
096: * that was done against the Unix-login(), you can really trust in in that
097: * case.
098: * Subclasses should override this. It simply does nothing in this
099: * implementation.
100: *
101: * @param udata UserData for this user
102: * @param domain Domain name the user used to log on
103: * @param passwd Password to verify
104: */
105: public void authenticatePostUserData(UserData udata, String domain,
106: String password) throws InvalidPasswordException {
107: }
108:
109: /**
110: * Tell WebMail whether this authentication method allows users to
111: * change their passwords.
112: * A Password-change option is then shown in the Options-Dialog.
113: */
114: public boolean canChangePassword() {
115: return true;
116: }
117:
118: public void changePassword(UserData udata, String newpassword,
119: String verify) throws InvalidPasswordException {
120: }
121:
122: } // Authenticator
|