| java.lang.Object com.caucho.server.security.PasswordDigest
All known Subclasses: com.caucho.http.security.PasswordDigest,
PasswordDigest | public class PasswordDigest (Code) | | Calculates a digest for the user and password.
If the realm is missing, the digest will calculate:
MD5(user + ':' + password)
If the realm is specified, the digest will calculate:
MD5(user + ':' + realm + ':' + password)
The second version matches the way HTTP digest authentication
is handled, so it is the preferred method for storing passwords.
The returned result is the base64 encoding of the digest.
|
Method Summary | |
protected static void | addDigestUTF8(MessageDigest digest, String string) Adds the string to the digest using a UTF8 encoding. | public void | addText(String value) Sets the algorithm for bean-style init. | protected static String | digestToBase64(byte[] digest, int len) | protected static String | digestToHex(byte[] digest, int len) | protected static String | digestToOldBase64(byte[] digest, int len) | protected String | digestToString(byte[] digest, int len) Convert the digest byte array to a string. | public String | getAlgorithm() Returns the message digest algorithm. | public String | getFormat() Returns the message digest format (base64 or hex). | public String | getPasswordDigest(String password) | public String | getPasswordDigest(String user, String password) | public String | getPasswordDigest(String user, String password, String realm) | public String | getPasswordDigest(HttpServletRequest request, HttpServletResponse response, ServletContext app, String user, String password) Returns the digest of the user/password
The default implementation returns the digest of
user:password or user:realm:password if a
default realm has been configured. | public String | getPasswordDigest(HttpServletRequest request, HttpServletResponse response, ServletContext app, String user, String password, String realm) Returns the digest of the user/password
The default implementation returns the digest of
user:realm:password. | public String | getRealm() Returns the message digest default realm. | public synchronized void | init() Initialize the digest. | public void | setAlgorithm(String algorithm) Returns the message digest algorithm. | public void | setFormat(String format) Set the message digest format (base64 or hex). | public void | setOldEncoding(boolean isOldEncoding) Sets true for the old, buggy encoding. | public void | setRealm(String realm) | protected byte[] | stringToDigest(String s) Convert the string to a digest byte array. | public String | toString() | protected void | updateDigest(MessageDigest digest, String user, String password, String realm) |
addDigestUTF8 | protected static void addDigestUTF8(MessageDigest digest, String string)(Code) | | Adds the string to the digest using a UTF8 encoding.
|
addText | public void addText(String value) throws ConfigException(Code) | | Sets the algorithm for bean-style init.
|
digestToBase64 | protected static String digestToBase64(byte[] digest, int len)(Code) | | |
digestToHex | protected static String digestToHex(byte[] digest, int len)(Code) | | |
digestToOldBase64 | protected static String digestToOldBase64(byte[] digest, int len)(Code) | | |
digestToString | protected String digestToString(byte[] digest, int len)(Code) | | Convert the digest byte array to a string.
|
getAlgorithm | public String getAlgorithm()(Code) | | Returns the message digest algorithm.
|
getFormat | public String getFormat()(Code) | | Returns the message digest format (base64 or hex).
|
getPasswordDigest | public String getPasswordDigest(HttpServletRequest request, HttpServletResponse response, ServletContext app, String user, String password) throws ServletException(Code) | | Returns the digest of the user/password
The default implementation returns the digest of
user:password or user:realm:password if a
default realm has been configured.
Parameters: request - the http request Parameters: response - the http response Parameters: app - the servlet context Parameters: user - the user name Parameters: password - the cleartext password |
getPasswordDigest | public String getPasswordDigest(HttpServletRequest request, HttpServletResponse response, ServletContext app, String user, String password, String realm) throws ServletException(Code) | | Returns the digest of the user/password
The default implementation returns the digest of
user:realm:password. If the realm is null, it will use
user:password.
Parameters: request - the http request Parameters: response - the http response Parameters: app - the servlet context Parameters: user - the user name Parameters: password - the cleartext password Parameters: realm - the security realm |
getRealm | public String getRealm()(Code) | | Returns the message digest default realm.
|
setAlgorithm | public void setAlgorithm(String algorithm)(Code) | | Returns the message digest algorithm.
|
setFormat | public void setFormat(String format)(Code) | | Set the message digest format (base64 or hex).
|
setOldEncoding | public void setOldEncoding(boolean isOldEncoding)(Code) | | Sets true for the old, buggy encoding.
|
setRealm | public void setRealm(String realm)(Code) | | Set the message digest default realm
|
stringToDigest | protected byte[] stringToDigest(String s)(Code) | | Convert the string to a digest byte array.
|
|
|