01: /** OTPAuthDisplayMngr provides info/setup for user interaction with the
02: * OTPAuthenticator class. There are a few special details to using
03: * RFC1938 OTPs when it comes to changing them. Namely, rather than having
04: * the server compute the OTP, the client computes it and gives it to the
05: * serevr. Thus there needs to be a challenge used in changing the
06: * password.
07: *
08: *
09: * $Id: OTPAuthDisplayMngr.java,v 1.1.1.1 2002/10/02 18:42:55 wastl Exp $
10: *
11: * @author Devin Kowatch
12: * @version $Revision: 1.1.1.1 $
13: * @see org.webengruven.auth.CRAuthenticator
14: * @see OTPAuthenticator
15: *
16: * Copyright (C) 2000 Devin Kowatch
17: */package org.webengruven.webmail.auth;
18:
19: import org.webengruven.webmail.auth.*;
20:
21: import net.wastl.webmail.server.*;
22: import net.wastl.webmail.exceptions.*;
23: import net.wastl.webmail.xml.*;
24:
25: public class OTPAuthDisplayMngr extends CRAuthDisplayMngr {
26: /* the length of the passwords */
27: private int PASS_LEN = 30;
28:
29: /** Default C'tor */
30: public OTPAuthDisplayMngr() {
31: super (null);
32: }
33:
34: /** Construct with a ref to the Authenticator using this object. It
35: * will be used later.
36: */
37: public OTPAuthDisplayMngr(OTPAuthenticatorIface a) {
38: auth = a;
39: }
40:
41: /** Setup state vars for the password change prompt.
42: * @param ud UserData for the user who will have their password changed
43: * @param model The model to set state vars in
44: */
45: public void setPassChangeVars(UserData ud, XMLGenericModel model)
46: throws WebMailException {
47: try {
48: OTPAuthenticatorIface otp_auth = (OTPAuthenticatorIface) auth;
49:
50: model.setStateVar("new challenge", otp_auth
51: .getNewChallenge(ud));
52: model.setStateVar("pass len", String.valueOf(PASS_LEN));
53: } catch (ClassCastException e) {
54: e.printStackTrace();
55: throw new WebMailException(
56: "tried to use OTPAuthDisplayMngr"
57: + " with an Authenticator other than OTPAuthenticator");
58: }
59: }
60:
61: /** Get the name of the template that can display an OTP password
62: * change screen.
63: * @return The name of the template
64: */
65: public String getPassChangeTmpl() {
66: return "otpchangepass";
67: }
68: }
|