01: /*
02: * ========================================================================
03: *
04: * Copyright 2001-2004 The Apache Software Foundation.
05: *
06: * Licensed under the Apache License, Version 2.0 (the "License");
07: * you may not use this file except in compliance with the License.
08: * You may obtain a copy of the License at
09: *
10: * http://www.apache.org/licenses/LICENSE-2.0
11: *
12: * Unless required by applicable law or agreed to in writing, software
13: * distributed under the License is distributed on an "AS IS" BASIS,
14: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15: * See the License for the specific language governing permissions and
16: * limitations under the License.
17: *
18: * ========================================================================
19: */
20: package org.apache.cactus.client.authentication;
21:
22: /**
23: * This class was designed with the simple assumption that ALL authentication
24: * implementations will have a String <code>Name</code> and a String
25: * <code>Password</code>. Two abstract functions <code>validateName</code> and
26: * <code>validatePassword</code> provide for concrete implementations to
27: * perform character validation. All the work is then done in the
28: * <code>configure</code> abstract function. In the
29: * <code>BasicAuthentication</code> class, for example, the configuring is done
30: * by adding the request property "Authorization" with a value
31: * "Basic <base64encode of 'userid:password'>".
32: *
33: * @since 1.3
34: *
35: * @version $Id: AbstractAuthentication.java 238991 2004-05-22 11:34:50Z vmassol $
36: */
37: public abstract class AbstractAuthentication implements Authentication {
38: /**
39: * User name part of the Credential
40: */
41: private String name;
42:
43: /**
44: * Password part of the Credential
45: */
46: private String password;
47:
48: /**
49: * @param theName user name of the Credential
50: * @param thePassword user password of the Credential
51: */
52: public AbstractAuthentication(String theName, String thePassword) {
53: setName(theName);
54: setPassword(thePassword);
55: }
56:
57: /**
58: * Sets the user name.
59: *
60: * @param theName user name of the Credential
61: */
62: public final void setName(String theName) {
63: this .name = theName;
64: }
65:
66: /**
67: * @return the user name of the Credential
68: */
69: public final String getName() {
70: return this .name;
71: }
72:
73: /**
74: * Sets the user password of the Credential.
75: *
76: * @param thePassword the user password of the Credential
77: */
78: public final void setPassword(String thePassword) {
79: this .password = thePassword;
80: }
81:
82: /**
83: * @return the user password of the Credential
84: */
85: public final String getPassword() {
86: return this.password;
87: }
88: }
|