|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object | +--com.cafesoft.core.http.HttpAuthorization
This class supports HTTP Basic authentication via username/password. If an HTTP 'Authorization' header is provided in the HttpServletRequest, then it's associated username and password can be accessed using methods in this class.
The Authorization header value is: "Basic username:password" (not including the double quotes). In addition, the 'username:password' portion of the the header value are "BASE64 encoded", which provides a feeble attempt at password obfuscation.
To use this class:
HttpAuthorization httpAuth = new HttpAuthorization(req); String username = httpAuth.getUser(); String password = httpAuth.getPassword();
You can check for existence of the 'Authorization' header yourself prior to using this class if a username and password are required. If the header is not specified with the request, then getUser() and getPassword() will return null values.
| Constructor Summary | |
HttpAuthorization(javax.servlet.http.HttpServletRequest req)
Create an Authorization object by parsing the "Authorization:" header of the specified HttpServletRequest object. |
|
| Method Summary | |
String |
getPassword()
Get the password associated with the Authorization. |
String |
getUser()
Get the user associated with the Authorization. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public HttpAuthorization(javax.servlet.http.HttpServletRequest req)
req - The HttpServletRequest object.| Method Detail |
public String getUser()
public String getPassword()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||