|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.caucho.http.security.AbstractAuthenticator | +--com.caucho.http.security.JdbcAuthenticator
An authenticator using JDBC.
The default password schema looks something like:CREATE TABLE password ( username VARCHAR(250) NOT NULL, password VARCHAR(250), cookie VARCHAR(250), PRIMARY_KEY(username) )
Field Summary | |
protected java.lang.String |
cookieDomain
|
protected long |
cookieMaxAge
|
protected int |
cookieVersion
|
protected boolean |
useCookie
|
Fields inherited from class com.caucho.http.security.AbstractAuthenticator |
LOGIN_NAME, passwordDigest, passwordDigestName, principalCache, principalCacheSize |
Constructor Summary | |
JdbcAuthenticator()
|
Method Summary | |
protected void |
addAuthCookie(HttpServletRequest request,
HttpServletResponse response,
ServletContext application,
java.security.Principal user)
Adds a cookie to store authentication. |
java.security.Principal |
authenticateCookie(java.lang.String cookieValue)
Authenticate based on a cookie. |
java.lang.String |
getCookieAuthQuery()
Gets the cookie auth query. |
java.lang.String |
getCookieAuthUpdate()
Gets the cookie update query. |
java.lang.String |
getCookieDomain()
Returns the domain for a login cookie. |
long |
getCookieMaxAge()
Returns the max-age for a login cookie. |
int |
getCookieVersion()
Returns the version for a login cookie. |
protected java.lang.String |
getDigestPassword(HttpServletRequest request,
HttpServletResponse response,
ServletContext application,
java.lang.String username,
java.lang.String realm)
Returns the password for authenticators too lazy to calculate the digest. |
java.lang.String |
getPasswordQuery()
Gets the password query. |
java.lang.String |
getPoolName()
Gets the database pool name. |
java.lang.String |
getRoleQuery()
Gets the role query. |
boolean |
getUseCookie()
Returns true if Resin should generate the resinauth cookie by default. |
protected java.security.Principal |
getUserPrincipalImpl(HttpServletRequest request,
ServletContext application)
Gets the user from a persistent cookie, uaing authenticateCookie to actually look the cookie up. |
void |
init()
Initialize the authenticator. |
boolean |
isUserInRole(HttpServletRequest request,
HttpServletResponse response,
ServletContext application,
java.security.Principal principal,
java.lang.String role)
Returns true if the user plays the named role. |
java.security.Principal |
loginImpl(HttpServletRequest request,
HttpServletResponse response,
ServletContext application,
java.lang.String username,
java.lang.String password)
Authenticates the user given the request. |
java.security.Principal |
loginImpl(java.lang.String username,
java.lang.String password)
Authenticates the user given the request. |
void |
logout(HttpServletRequest request,
HttpServletResponse response,
ServletContext application,
java.security.Principal user)
Logs the user out from the session. |
void |
setCookieAuthQuery(java.lang.String query)
Sets the cookie auth query. |
void |
setCookieAuthUpdate(java.lang.String query)
Sets the cookie update query. |
void |
setCookieDomain(java.lang.String cookieDomain)
Sets the domain for a login cookie. |
void |
setCookieLogout(boolean cookieLogout)
If true, the cookie is removed on logout |
void |
setCookieMaxAge(long cookieMaxAge)
Sets the max age for a login cookie. |
void |
setCookieVersion(int version)
Sets the version for a login cookie. |
void |
setPasswordQuery(java.lang.String query)
Sets the password query. |
void |
setPoolName(java.lang.String name)
Sets the database pool name. |
void |
setRoleQuery(java.lang.String query)
Sets the role query. |
void |
setUseCookie(boolean useCookie)
Set true if Resin should generate the resinauth cookie by default. |
boolean |
updateCookie(java.security.Principal user,
java.lang.String cookieValue)
Associates a user with a persistent cookie. |
Methods inherited from class com.caucho.http.security.AbstractAuthenticator |
digest, getDigestSecret, getPasswordDigest, getPrincipalCacheSize, getUserPrincipal, login, loginDigest, loginDigestImpl, setPasswordDigest, setPrincipalCacheSize |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected boolean useCookie
protected int cookieVersion
protected java.lang.String cookieDomain
protected long cookieMaxAge
Constructor Detail |
public JdbcAuthenticator()
Method Detail |
public java.lang.String getPoolName()
public void setPoolName(java.lang.String name)
public java.lang.String getPasswordQuery()
Example:
SELECT password FROM LOGIN WHERE username=?
public void setPasswordQuery(java.lang.String query)
public java.lang.String getCookieAuthQuery()
public void setCookieAuthQuery(java.lang.String query)
public java.lang.String getCookieAuthUpdate()
public void setCookieAuthUpdate(java.lang.String query)
public void setCookieLogout(boolean cookieLogout)
public java.lang.String getRoleQuery()
public void setRoleQuery(java.lang.String query)
public boolean getUseCookie()
public void setUseCookie(boolean useCookie)
public int getCookieVersion()
public void setCookieVersion(int version)
public java.lang.String getCookieDomain()
public void setCookieDomain(java.lang.String cookieDomain)
public long getCookieMaxAge()
public void setCookieMaxAge(long cookieMaxAge)
public void init() throws ServletException
init
in class AbstractAuthenticator
public java.security.Principal loginImpl(HttpServletRequest request, HttpServletResponse response, ServletContext application, java.lang.String username, java.lang.String password) throws ServletException
loginImpl
in class AbstractAuthenticator
username
- the user name for the loginpassword
- the password for the loginprotected void addAuthCookie(HttpServletRequest request, HttpServletResponse response, ServletContext application, java.security.Principal user)
public java.security.Principal loginImpl(java.lang.String username, java.lang.String password) throws ServletException
username
- the user name for the loginpassword
- the password for the loginprotected java.lang.String getDigestPassword(HttpServletRequest request, HttpServletResponse response, ServletContext application, java.lang.String username, java.lang.String realm) throws ServletException
getDigestPassword
in class AbstractAuthenticator
protected java.security.Principal getUserPrincipalImpl(HttpServletRequest request, ServletContext application) throws ServletException
AbstractAuthenticator
getUserPrincipalImpl
in class AbstractAuthenticator
public java.security.Principal authenticateCookie(java.lang.String cookieValue) throws ServletException
cookieValue
- the value of the resin-auth cookiepublic boolean updateCookie(java.security.Principal user, java.lang.String cookieValue)
user
- the user for the cookiecookieValue
- the value of the resin-auth cookiepublic boolean isUserInRole(HttpServletRequest request, HttpServletResponse response, ServletContext application, java.security.Principal principal, java.lang.String role)
AbstractAuthenticator
isUserInRole
in class AbstractAuthenticator
com.caucho.http.security.AbstractAuthenticator
request
- the servlet requestuser
- the user to testrole
- the role to testpublic void logout(HttpServletRequest request, HttpServletResponse response, ServletContext application, java.security.Principal user) throws ServletException
logout
in class AbstractAuthenticator
request
- the servlet request
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |