|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
ObjectDefaultHandler
DefaultLoginHandler
public class DefaultLoginHandler
Implements default J2EE web-tier login handling.
Constructor Summary | |
---|---|
DefaultLoginHandler()
|
Method Summary | |
---|---|
Principal |
getUserPrincipal(HttpServletRequest request)
Get the current user. |
void |
init(ServletContext servletContext)
Initialize. |
boolean |
isUserInRole(String roleName,
HttpServletRequest request)
Tell whether the current user is in a given role. |
void |
login(String username,
String password,
HttpServletRequest request,
HttpServletResponse response)
Log in the given user. |
void |
logout(boolean invalidateSessions,
HttpServletRequest request,
HttpServletResponse response)
Log out the current user. |
Methods inherited from class DefaultHandler |
---|
getServletContext, reinit |
Methods inherited from class Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface Handler |
---|
reinit |
Constructor Detail |
---|
public DefaultLoginHandler()
Method Detail |
---|
public void init(ServletContext servletContext)
DefaultHandler
init
in interface Handler
init
in class DefaultHandler
servletContext
- the ServletContext for the webapp that is creating this object.public void login(String username, String password, HttpServletRequest request, HttpServletResponse response) throws LoginException
LoginHandler
login
in interface LoginHandler
username
- the user to log in.password
- the user's password.request
- the current HttpServletRequest.
LoginException
- if the login fails.public void logout(boolean invalidateSessions, HttpServletRequest request, HttpServletResponse response)
LoginHandler
logout
in interface LoginHandler
invalidateSessions
- if true
, current sessions associated with the current
logged-in user will be invalidated.request
- the current HttpServletRequest.public boolean isUserInRole(String roleName, HttpServletRequest request)
LoginHandler
isUserInRole
in interface LoginHandler
roleName
- the role to check.request
- the current HttpServletRequest.
true
if the current logged-in user is in the given role.public Principal getUserPrincipal(HttpServletRequest request)
LoginHandler
getUserPrincipal
in interface LoginHandler
request
- the current HttpServletRequest.
Principal
that represents the current logged-in user.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |