com.caucho.http.security
Class BasicLogin
java.lang.Object
|
+--com.caucho.http.security.AbstractLogin
|
+--com.caucho.http.security.BasicLogin
- public class BasicLogin
- extends AbstractLogin
Implements the "basic" auth-method. Basic uses the
HTTP authentication with WWW-Authenticate and SC_UNAUTHORIZE.
Field Summary |
protected java.lang.String |
realm
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
realm
protected java.lang.String realm
BasicLogin
public BasicLogin()
setRealmName
public void setRealmName(java.lang.String realm)
- Sets the login realm.
getRealmName
public java.lang.String getRealmName()
- Gets the realm.
getAuthType
public java.lang.String getAuthType()
- Returns the authentication type.
- Overrides:
getAuthType
in class AbstractLogin
authenticate
public java.security.Principal authenticate(HttpServletRequest request,
HttpServletResponse response,
ServletContext application)
throws ServletException,
java.io.IOException
- Logs a user in with a user name and a password. Basic authentication
extracts the user and password from the authorization header. If
the user/password is missing, authenticate will send a basic challenge.
- Overrides:
authenticate
in class AbstractLogin
- Parameters:
request
- servlet requestresponse
- servlet response, in case any cookie need sending.application
- servlet application- Returns:
- the logged in principal on success, null on failure.
getUserPrincipal
public java.security.Principal getUserPrincipal(HttpServletRequest request,
HttpServletResponse response,
ServletContext application)
throws ServletException
- Returns the current user with the user name and password.
- Overrides:
getUserPrincipal
in class AbstractLogin
- Parameters:
request
- servlet requestresponse
- servlet response, in case any cookie need sending.application
- servlet application- Returns:
- the logged in principal on success, null on failure.
sendBasicChallenge
protected void sendBasicChallenge(HttpServletResponse res)
throws ServletException,
java.io.IOException
- Sends a challenge for basic authentication.
getBasicPrincipal
protected java.security.Principal getBasicPrincipal(HttpServletRequest request,
HttpServletResponse response,
ServletContext application)
throws ServletException
- Returns the principal from a basic authentication
- Parameters:
auth
- the authenticator for this application.