|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.zeevbelkin.web.filter.access.Yaaf.SessionSecurityInfo
public static class Yaaf.SessionSecurityInfo
The filter
keeps info about the user identity, and additional info required to organize the login process,
in this session bean that implements also Principal
interface. This bean may be obtained by the
getUserPrincipal request method call, or by the name "SessionSecurityInfo".
Yet one, very important role of this bean is that it has a special method
setExplicitLogin
to mark the login process as "explicit" or "on demand" (by default, the filter means that
the login is on demand one).
Constructor Summary | |
---|---|
Yaaf.SessionSecurityInfo()
|
Method Summary | |
---|---|
void |
bye(javax.servlet.http.HttpServletRequest rq,
javax.servlet.http.HttpServletResponse rsp)
Logs the user out. |
void |
completeLogin(javax.servlet.ServletRequest request,
javax.servlet.ServletResponse response)
|
java.lang.Object |
getLock()
Gets the bean locking object (the object that owns the thread sychronization monitor) for the login/logout operations. |
java.lang.String |
getName()
|
Yaaf.RoleResolver |
getRoleResolver()
Getter for property roleResolver. |
java.lang.String |
getSavedRequestID()
Returns login request ID. |
int |
hashCode()
|
void |
invalidate()
marks the session as a session with unauthenticated user |
boolean |
isExplicitLogin()
Getter of the explicitLogin property |
boolean |
isSavedRequestValid(javax.servlet.http.HttpServletRequest rq)
Compares the actual login request ID with the ID passed as a request parameter (referer parameter) with name yaacfiRqId, returns true if both the values are the same. |
boolean |
isUserInRole(java.lang.String role)
checks if a user has a role |
void |
saveLogin(javax.servlet.http.HttpServletRequest rq,
javax.servlet.http.HttpServletResponse rsp,
int days)
Saves login info in a cookie if a saved login handler SavedLoginHandler
has been specified in the filter configuration. |
void |
setExplicitLogin(boolean explicitLogin)
Marks the current login process as an explicit or on demand one. |
void |
setName(java.lang.String userId)
sets a remote user name to the session. |
void |
setRoleResolver(Yaaf.RoleResolver roleResolver)
Setter for property roleResolver. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface java.security.Principal |
---|
equals, toString |
Constructor Detail |
---|
public Yaaf.SessionSecurityInfo()
Method Detail |
---|
public java.lang.String getName()
getName
in interface java.security.Principal
public void setName(java.lang.String userId)
setRoleResolver
to provide
info about the user roles to the filter.
userId
- remote user namepublic void invalidate()
public int hashCode()
hashCode
in interface java.security.Principal
hashCode
in class java.lang.Object
public boolean isUserInRole(java.lang.String role)
isUserInRole
in interface Yaaf.RoleResolver
role
- the role to check
public Yaaf.RoleResolver getRoleResolver()
public void setRoleResolver(Yaaf.RoleResolver roleResolver)
roleResolver
- New value of property roleResolver.public void saveLogin(javax.servlet.http.HttpServletRequest rq, javax.servlet.http.HttpServletResponse rsp, int days)
SavedLoginHandler
has been specified in the filter configuration. The filter will
sign in a user by an automatic ways if he/she has a valid saved login
info and the filter is configured to work with a saved login handler.
days
- time in days to keep the loginpublic void bye(javax.servlet.http.HttpServletRequest rq, javax.servlet.http.HttpServletResponse rsp)
public java.lang.String getSavedRequestID()
isSavedRequestValid(javax.servlet.http.HttpServletRequest)
public boolean isSavedRequestValid(javax.servlet.http.HttpServletRequest rq)
getSavedRequestID()
public java.lang.Object getLock()
public void completeLogin(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response)
public boolean isExplicitLogin()
public void setExplicitLogin(boolean explicitLogin)
<bean:cookie name="test_user" id="test_user" value=""/> <bean:cookie name="test_secret" id="test_secret" value=""/> <bean:define id="ssi" name="SessionSecurityInfo" scope="session" type="Yaaf.SessionSecurityInfo"/> <!-- Mark this login procedure as "login on demand". It is necessary to do this because a user can begin and not to finish successfuly an explicit login process and then begin the login on demand process (that starts with a cookie login). --> <jsp:setProperty name="ssi" property="explicitLogin" value="false"/> <% // // Here is one hardcoded username "pupkin" with a right secret "right_secret". //Real applications ordinary check the user names/cookie secrets with a //database. // if ("pupkin".equals(test_user.getValue())&&"right_secret".equals(test_secret.getValue())) { // We authenticate the user by cookie, // no need in any user interaction ssi.setName("pupkin"); ssi.completeLogin(request,response); return; } %> <logic:forward name="loginScreen"/>
explicitLogin
- New value of property explicitLogin.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |