|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object velosurf.web.auth.BaseAuthenticator
public abstract class BaseAuthenticator
This abstract class implements an authentication mechanism. It is meant to be declared
in toolbox.xml as a session-scoped tool.
The password encryption method can be specified in toolbox.xml
using the method
parameter
(when not specified, passwords are passed in clear).
You will need to implement the same password encryption on the client side using the adequate
javascript files. A /src/javascript/md5.js
file is provided to help implementing the HmacMD5 method.
Still, if you really want security, use HTTPS!
Field Summary | |
---|---|
private java.lang.String |
challenge
challenge value |
private static int |
CHALLENGE_LENGTH
length of challenge |
private java.lang.String |
method
encryption method |
private static java.util.Random |
random
random number generator |
private java.lang.ref.WeakReference<javax.servlet.http.HttpSession> |
session
keep a reference on the session |
Constructor Summary | |
---|---|
BaseAuthenticator()
|
Method Summary | |
---|---|
boolean |
checkLogin(java.lang.String login,
java.lang.String answer)
Check received answer. |
void |
configure(java.util.Map config)
configure this tool. |
private java.lang.String |
generateAnswer(java.lang.String password)
Generate the correct answer. |
java.lang.String |
getChallenge()
This method generates a new challenge each time it is called. |
java.lang.Object |
getLoggedUser()
|
abstract java.lang.String |
getPassword(java.lang.String login)
get the password corresponding to a login. |
abstract java.lang.Object |
getUser(java.lang.String login)
Get the user object corresponding to a login |
void |
init(java.lang.Object initData)
initialize this tool. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private java.lang.String method
private java.lang.String challenge
private static java.util.Random random
private static final int CHALLENGE_LENGTH
private java.lang.ref.WeakReference<javax.servlet.http.HttpSession> session
Constructor Detail |
---|
public BaseAuthenticator()
Method Detail |
---|
public abstract java.lang.String getPassword(java.lang.String login)
login
- login
public abstract java.lang.Object getUser(java.lang.String login)
login
- login
public void init(java.lang.Object initData)
initData
- a view contextpublic void configure(java.util.Map config)
config
- map containing an optional "method" parameterpublic java.lang.String getChallenge()
public boolean checkLogin(java.lang.String login, java.lang.String answer)
login
- loginanswer
- received answer
private java.lang.String generateAnswer(java.lang.String password)
password
-
public java.lang.Object getLoggedUser()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |