The ServletRequest
interface defined in Servlet API provides the following methods for authentication.
authenticate() : Uses the container's login mechanism configured for the ServletContext to authenticate the user making this request.
getAuthType() : Returns the name of the authentication scheme used to protect the servlet.
getUserPrincipal() : Returns a java.security.Principal object containing the name of the current authenticated user.
isUserInRole() : Returns a boolean indicating whether the authenticated user is included in the specified logical role.
login() : Validate the provided username and password in the password validation realm used by the web container login mechanism configured for the ServletContext.
logout() : Establish null as the value returned when getUserPrincipal(), getRemoteUser()
, and getAuthType()
is called on the request.