com.protomatter.util
Class BasicAuthUtil
java.lang.Object
|
+--com.protomatter.util.BasicAuthUtil
- public class BasicAuthUtil
- extends java.lang.Object
A utility class that provides methods for checking and
requiring basic authentication in servlets.
Method Summary |
static java.lang.String |
getAuthPassword(javax.servlet.http.HttpServletRequest request)
Decodes the "Authorization" header and retrieves the
password from it. |
static java.lang.String |
getAuthUsername(javax.servlet.http.HttpServletRequest request)
Decodes the "Authorization" header and retrieves the
user's name from it. |
static void |
requireAuthentication(java.lang.String realm,
javax.servlet.http.HttpServletResponse resp)
Sends coprrect headers to require basic authentication for the
given realm. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
getAuthUsername
public static java.lang.String getAuthUsername(javax.servlet.http.HttpServletRequest request)
- Decodes the "Authorization" header and retrieves the
user's name from it. Returns null if the header is not present.
getAuthPassword
public static java.lang.String getAuthPassword(javax.servlet.http.HttpServletRequest request)
- Decodes the "Authorization" header and retrieves the
password from it. Returns null if the header is not present.
requireAuthentication
public static void requireAuthentication(java.lang.String realm,
javax.servlet.http.HttpServletResponse resp)
throws java.io.IOException
- Sends coprrect headers to require basic authentication for the
given realm.