KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > cactus > client > authentication > AbstractAuthentication


1 /*
2  * ========================================================================
3  *
4  * Copyright 2001-2004 The Apache Software Foundation.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
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 &lt;base64encode of 'userid:password'&gt;".
32  *
33  * @since 1.3
34  *
35  * @version $Id: AbstractAuthentication.java,v 1.1 2004/05/22 11:34:48 vmassol Exp $
36  */

37 public abstract class AbstractAuthentication implements Authentication
38 {
39     /**
40      * User name part of the Credential
41      */

42     private String JavaDoc name;
43
44     /**
45      * Password part of the Credential
46      */

47     private String JavaDoc password;
48
49     /**
50      * @param theName user name of the Credential
51      * @param thePassword user password of the Credential
52      */

53     public AbstractAuthentication(String JavaDoc theName, String JavaDoc thePassword)
54     {
55         setName(theName);
56         setPassword(thePassword);
57     }
58
59     /**
60      * Sets the user name.
61      *
62      * @param theName user name of the Credential
63      */

64     public final void setName(String JavaDoc theName)
65     {
66         this.name = theName;
67     }
68
69     /**
70      * @return the user name of the Credential
71      */

72     public final String JavaDoc getName()
73     {
74         return this.name;
75     }
76
77     /**
78      * Sets the user password of the Credential.
79      *
80      * @param thePassword the user password of the Credential
81      */

82     public final void setPassword(String JavaDoc thePassword)
83     {
84         this.password = thePassword;
85     }
86
87     /**
88      * @return the user password of the Credential
89      */

90     public final String JavaDoc getPassword()
91     {
92         return this.password;
93     }
94 }
95
Popular Tags