public class LoginServlet
extends javax.servlet.http.HttpServlet
The LoginServlet enables form-based JAAS login. The LoginServlet is able to processes form-based at the four different stage:
Example servlet configuration:
LoginServlet org.hippoecm.hst.security.servlet.LoginServlet LoginServlet /login/* Login Resource /login/resource everybody FORM HSTSITE /login/login /WEB-INF/jsp/login-failure.jsp Default role for every authenticated user everybody
Note:
Modifier and Type | Field and Description |
---|---|
static String |
BASE_NAME |
static String |
DEFAULT_LOGIN_RESOURCE_PATH |
protected String |
defaultLoginErrorPagePath |
protected String |
defaultLoginFormPagePath |
protected String |
defaultLoginResourcePath |
protected String |
defaultLoginSecurityCheckFormPagePath |
static String |
DESTINATION |
static String |
DESTINATION_ATTR_NAME |
static String |
MODE_LOGIN_ERROR |
static String |
MODE_LOGIN_FORM |
static String |
MODE_LOGIN_LOGIN |
static String |
MODE_LOGIN_LOGOUT |
static String |
MODE_LOGIN_PROXY |
static String |
MODE_LOGIN_RESOURCE |
static String |
PASSWORD |
static String |
PASSWORD_ATTR_NAME |
protected String |
requestCharacterEncoding |
static String |
USERNAME |
static String |
USERNAME_ATTR_NAME |
Constructor and Description |
---|
LoginServlet() |
Modifier and Type | Method and Description |
---|---|
protected javax.jcr.Credentials |
createSubjectRepositoryCredentials(javax.servlet.http.HttpServletRequest request)
Creates repository credentials for the subject.
|
void |
doGet(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response) |
protected void |
doLoginError(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response) |
protected void |
doLoginForm(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response) |
protected void |
doLoginLogin(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response) |
protected void |
doLoginLogout(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response) |
protected void |
doLoginProxy(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response) |
protected void |
doLoginResource(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response) |
void |
doPost(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response) |
static String |
getBaseURL(javax.servlet.http.HttpServletRequest request) |
static String |
getFullyQualifiedURL(javax.servlet.http.HttpServletRequest request,
String destination) |
protected String |
getMode(javax.servlet.http.HttpServletRequest request) |
void |
init(javax.servlet.ServletConfig servletConfig) |
protected boolean |
isContextPathInUrl(javax.servlet.http.HttpServletRequest request)
This is a hook into the HstServices component manager to look up in the
VirtualHosts whether the contextPath should be in the
URL. |
protected String |
normalizeDestination(String destination,
javax.servlet.http.HttpServletRequest request) |
protected void |
renderAutoLoginPage(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response) |
protected void |
renderLoginErrorPage(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response) |
protected void |
renderLoginFormPage(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response) |
protected void |
renderTemplatePage(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
String templateResourcePath,
Map<String,Object> params) |
doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service, service
public static final String DESTINATION
public static final String USERNAME
public static final String PASSWORD
public static final String BASE_NAME
public static final String DESTINATION_ATTR_NAME
public static final String USERNAME_ATTR_NAME
public static final String PASSWORD_ATTR_NAME
public static final String DEFAULT_LOGIN_RESOURCE_PATH
public static final String MODE_LOGIN_FORM
public static final String MODE_LOGIN_PROXY
public static final String MODE_LOGIN_LOGIN
public static final String MODE_LOGIN_RESOURCE
public static final String MODE_LOGIN_LOGOUT
public static final String MODE_LOGIN_ERROR
protected String requestCharacterEncoding
protected String defaultLoginFormPagePath
protected String defaultLoginResourcePath
protected String defaultLoginSecurityCheckFormPagePath
protected String defaultLoginErrorPagePath
public void init(javax.servlet.ServletConfig servletConfig) throws javax.servlet.ServletException
init
in interface javax.servlet.Servlet
init
in class javax.servlet.GenericServlet
javax.servlet.ServletException
public void doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws IOException, javax.servlet.ServletException
doGet
in class javax.servlet.http.HttpServlet
IOException
javax.servlet.ServletException
public final void doPost(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws IOException, javax.servlet.ServletException
doPost
in class javax.servlet.http.HttpServlet
IOException
javax.servlet.ServletException
protected String getMode(javax.servlet.http.HttpServletRequest request)
protected void doLoginForm(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws IOException, javax.servlet.ServletException
IOException
javax.servlet.ServletException
protected void doLoginProxy(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws IOException, javax.servlet.ServletException
IOException
javax.servlet.ServletException
protected void doLoginLogin(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws IOException, javax.servlet.ServletException
IOException
javax.servlet.ServletException
protected void doLoginResource(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws IOException, javax.servlet.ServletException
IOException
javax.servlet.ServletException
protected void doLoginLogout(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws IOException, javax.servlet.ServletException
IOException
javax.servlet.ServletException
protected void doLoginError(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws IOException, javax.servlet.ServletException
IOException
javax.servlet.ServletException
protected String normalizeDestination(String destination, javax.servlet.http.HttpServletRequest request)
protected javax.jcr.Credentials createSubjectRepositoryCredentials(javax.servlet.http.HttpServletRequest request)
This method is invoked to store a repository credentials for the subject. By default, this method creates a repository credentials with the same user/password credentials used during authentication.
A child class can override this method to behave differently.
request
- protected void renderLoginFormPage(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws IOException, javax.servlet.ServletException
IOException
javax.servlet.ServletException
protected void renderAutoLoginPage(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws IOException, javax.servlet.ServletException
IOException
javax.servlet.ServletException
protected void renderLoginErrorPage(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws IOException, javax.servlet.ServletException
IOException
javax.servlet.ServletException
protected void renderTemplatePage(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, String templateResourcePath, Map<String,Object> params) throws IOException, javax.servlet.ServletException
IOException
javax.servlet.ServletException
protected boolean isContextPathInUrl(javax.servlet.http.HttpServletRequest request)
VirtualHosts
whether the contextPath should be in the
URL. Although this can be overridden per VirtualHost
or Mount
, this is the best we can do at this moment as we do
not have an HstRequestContext
and also no ResolvedMount
thus.request
- true
when the global VirtualHosts
is configured to have the contextPath in the URLpublic static String getBaseURL(javax.servlet.http.HttpServletRequest request)
Copyright © 2008–2016 Hippo B.V. (http://www.onehippo.com). All rights reserved.