Class BasicAuthServlet
java.lang.Object
jakarta.servlet.GenericServlet
jakarta.servlet.http.HttpServlet
org.deltava.servlet.GenericServlet
org.deltava.servlet.BasicAuthServlet
- All Implemented Interfaces:
jakarta.servlet.Servlet, jakarta.servlet.ServletConfig, Serializable
- Direct Known Subclasses:
DownloadServlet, UploadServlet, WebServiceServlet
A servlet that supports basic HTTP authentication.
- Since:
- 1.0
- Version:
- 11.3
- Author:
- Luke
-
Nested Class Summary
Nested classes/interfaces inherited from class GenericServlet
GenericServlet.ForbiddenException, GenericServlet.NotFoundException, GenericServlet.ServletSecurityContext -
Field Summary
Fields inherited from class jakarta.servlet.http.HttpServlet
LEGACY_DO_HEAD -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected static Pilotauthenticate(jakarta.servlet.http.HttpServletRequest req) Authenticates the current web user.protected static voidSets the response headers for a basic authentication challenge.Methods inherited from class GenericServlet
getURLMethods inherited from class jakarta.servlet.http.HttpServlet
doDelete, doGet, doHead, doOptions, doPatch, doPost, doPut, doTrace, getLastModified, init, isSensitiveHeader, service, serviceMethods inherited from class jakarta.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
-
Constructor Details
-
BasicAuthServlet
BasicAuthServlet()
-
-
Method Details
-
authenticate
Authenticates the current web user.- Parameters:
req- the current HTTP servlet request- Returns:
- the authenticated Pilot's databse record, or null if not logged in
-
challenge
protected static void challenge(jakarta.servlet.http.HttpServletResponse rsp, String realm) throws IOException Sets the response headers for a basic authentication challenge.- Parameters:
rsp- the HTTP servlet responserealm- the realm name to present to the browser- Throws:
IOException- if a network error occurs
-