KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > opencms > security > I_CmsPasswordHandler


1 /*
2  * File : $Source: /usr/local/cvs/opencms/src/org/opencms/security/I_CmsPasswordHandler.java,v $
3  * Date : $Date: 2005/06/23 11:11:44 $
4  * Version: $Revision: 1.13 $
5  *
6  * This library is part of OpenCms -
7  * the Open Source Content Mananagement System
8  *
9  * Copyright (c) 2005 Alkacon Software GmbH (http://www.alkacon.com)
10  *
11  * This library is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU Lesser General Public
13  * License as published by the Free Software Foundation; either
14  * version 2.1 of the License, or (at your option) any later version.
15  *
16  * This library is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19  * Lesser General Public License for more details.
20  *
21  * For further information about Alkacon Software GmbH, please see the
22  * company website: http://www.alkacon.com
23  *
24  * For further information about OpenCms, please see the
25  * project website: http://www.opencms.org
26  *
27  * You should have received a copy of the GNU Lesser General Public
28  * License along with this library; if not, write to the Free Software
29  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
30  */

31
32 package org.opencms.security;
33
34 import org.opencms.configuration.I_CmsConfigurationParameterHandler;
35
36 /**
37  * Defines methods for OpenCms password validation.<p>
38  *
39  * @author Alexander Kandzior
40  * @author Carsten Weinholz
41  *
42  * @version $Revision: 1.13 $
43  *
44  * @since 6.0.0
45  */

46 public interface I_CmsPasswordHandler extends I_CmsConfigurationParameterHandler {
47
48     /**
49      * Flag for conversion of the password encoding.<p>
50      */

51     String JavaDoc CONVERT_DIGEST_ENCODING = "compatibility.convert.digestencoding";
52
53     /**
54      * String to identify the key value for md5 password hashes.<p>
55      */

56     String JavaDoc DIGEST_TYPE_MD5 = "md5";
57
58     /**
59      * String to identify the key value for unhashed passwords.<p>
60      */

61     String JavaDoc DIGEST_TYPE_PLAIN = "plain";
62
63     /**
64      * String to identify the key value for sha password hashes.<p>
65      */

66     String JavaDoc DIGEST_TYPE_SHA = "sha";
67
68     /**
69      * String to identify the key value for sha password hashes with 4 byte salt.<p>
70      */

71     String JavaDoc DIGEST_TYPE_SSHA = "ssha";
72
73     /**
74      * Creates an OpenCms password digest according to the default setting for method/encodings.<p>
75      *
76      * @param password the password to encrypt
77      * @return the password digest
78      * @throws CmsPasswordEncryptionException if something goes wrong
79      */

80     String JavaDoc digest(String JavaDoc password) throws CmsPasswordEncryptionException;
81
82     /**
83      * Creates an OpenCms password digest.<p>
84      *
85      * @param password the password to encrypt
86      * @param digestType the algorithm used for encryption (i.e. MD5, SHA ...)
87      * @param inputEncoding the encoding used when converting the password to bytes (i.e. UTF-8)
88      * @return the password digest
89      * @throws CmsPasswordEncryptionException if something goes wrong
90      */

91     String JavaDoc digest(String JavaDoc password, String JavaDoc digestType, String JavaDoc inputEncoding) throws CmsPasswordEncryptionException;
92
93     /**
94      * Returns the default digest type.<p>
95      *
96      * @return the default digest type
97      */

98     String JavaDoc getDigestType();
99
100     /**
101      * Returns the default password encoding.<p>
102      *
103      * @return the default password encoding
104      */

105     String JavaDoc getInputEncoding();
106
107     /**
108      * Sets the default digest type.<p>
109      *
110      * @param digestType the digest type used
111      */

112     void setDigestType(String JavaDoc digestType);
113
114     /**
115      * Sets the default input encoding.<p>
116      *
117      * @param inputEncoding the encoding used for translation the password string to bytes
118      */

119     void setInputEncoding(String JavaDoc inputEncoding);
120
121     /**
122      * This method checks if a new password follows the rules for
123      * new passwords, which are defined by a Class configured in
124      * the opencms.properties file.<p>
125      *
126      * If this method throws no exception the password is valid.<p>
127      *
128      * @param password the password to check
129      *
130      * @throws CmsSecurityException if validation of the password failed
131      */

132     void validatePassword(String JavaDoc password) throws CmsSecurityException;
133 }
Popular Tags