|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.caucho.server.security.AbstractAuthenticator
com.caucho.server.security.JdbcAuthenticator
public class JdbcAuthenticator
An authenticator using JDBC.
The default table schema looks something like:
CREATE TABLE LOGIN ( username VARCHAR(250) NOT NULL, password VARCHAR(250), cookie VARCHAR(250), PRIMARY KEY (username) );
<authenticator url="jdbc:database=jdbc/user">
</authenticator>
| Field Summary | |
|---|---|
protected java.lang.String |
_cookieDomain
|
protected long |
_cookieMaxAge
|
protected int |
_cookieVersion
|
protected boolean |
_useCookie
|
| Fields inherited from class com.caucho.server.security.AbstractAuthenticator |
|---|
_passwordDigest, _passwordDigestAlgorithm, _passwordDigestRealm, _principalCache, _principalCacheSize, LOGIN_NAME |
| 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. |
javax.sql.DataSource |
getDataSource()
Gets the database |
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 |
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(Period cookieMaxAge)
Sets the max age for a login cookie. |
void |
setCookieVersion(int version)
Sets the version for a login cookie. |
void |
setDataSource(javax.sql.DataSource dataSource)
Sets the database pool name. |
void |
setPasswordQuery(java.lang.String query)
Sets the password query. |
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.server.security.AbstractAuthenticator |
|---|
addRoleMapping, digest, getDigestSecret, getLogoutOnSessionTimeout, getPasswordDigest, getPasswordDigest, getPasswordDigestAlgorithm, getPasswordDigestRealm, getPrincipalCacheSize, getUserPrincipal, login, loginDigest, loginDigestImpl, logout, logout, setLogoutOnSessionTimeout, setPasswordDigest, setPasswordDigestAlgorithm, setPasswordDigestRealm, setPrincipalCacheSize, setSerializationHandle, stringToDigest, toString, writeReplace |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, 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 javax.sql.DataSource getDataSource()
public void setDataSource(javax.sql.DataSource dataSource)
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(Period cookieMaxAge)
public void init()
throws ServletException
init in interface ServletAuthenticatorinit in class AbstractAuthenticatorServletException
public java.security.Principal loginImpl(HttpServletRequest request,
HttpServletResponse response,
ServletContext application,
java.lang.String username,
java.lang.String password)
throws ServletException
loginImpl in class AbstractAuthenticatorusername - the user name for the loginpassword - the password for the login
ServletException
protected 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 login
ServletException
protected java.lang.String getDigestPassword(HttpServletRequest request,
HttpServletResponse response,
ServletContext application,
java.lang.String username,
java.lang.String realm)
throws ServletException
getDigestPassword in class AbstractAuthenticatorServletException
protected java.security.Principal getUserPrincipalImpl(HttpServletRequest request,
ServletContext application)
throws ServletException
AbstractAuthenticator
getUserPrincipalImpl in class AbstractAuthenticatorServletException
public java.security.Principal authenticateCookie(java.lang.String cookieValue)
throws ServletException
cookieValue - the value of the resin-auth cookie
ServletException
public boolean updateCookie(java.security.Principal user,
java.lang.String cookieValue)
user - the user for the cookiecookieValue - the value of the resin-auth cookie
public boolean isUserInRole(HttpServletRequest request,
HttpServletResponse response,
ServletContext application,
java.security.Principal principal,
java.lang.String role)
AbstractAuthenticator
isUserInRole in interface ServletAuthenticatorisUserInRole in class AbstractAuthenticatorrequest - the servlet requestapplication - the owning applicationprincipal - the user to testrole - the role to test
public void logout(HttpServletRequest request,
HttpServletResponse response,
ServletContext application,
java.security.Principal user)
throws ServletException
logout in class AbstractAuthenticatorrequest - the servlet request
ServletException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||