Author: markt
Date: Thu Feb 11 22:04:19 2016
New Revision: 1729903
URL: http://svn.apache.org/viewvc?rev=1729903&view=rev
Log:
Run the auto-formatter over AuthenticatorBase. I appear to have done this at
some point on the machine I am doing JASPIC dev and I need to unpick these
changes from the JASPIC ones.
Modified:
tomcat/trunk/java/org/apache/catalina/authenticator/AuthenticatorBase.java
Modified:
tomcat/trunk/java/org/apache/catalina/authenticator/AuthenticatorBase.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/authenticator/AuthenticatorBase.java?rev=1729903&r1=1729902&r2=1729903&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/authenticator/AuthenticatorBase.java
(original)
+++ tomcat/trunk/java/org/apache/catalina/authenticator/AuthenticatorBase.java
Thu Feb 11 22:04:19 2016
@@ -52,22 +52,21 @@ import org.apache.tomcat.util.descriptor
import org.apache.tomcat.util.http.FastHttpDateFormat;
import org.apache.tomcat.util.res.StringManager;
-
/**
* Basic implementation of the <b>Valve</b> interface that enforces the
* <code><security-constraint></code> elements in the web application
- * deployment descriptor. This functionality is implemented as a Valve
- * so that it can be omitted in environments that do not require these
- * features. Individual implementations of each supported authentication
- * method can subclass this base class as required.
+ * deployment descriptor. This functionality is implemented as a Valve so that
+ * it can be omitted in environments that do not require these features.
+ * Individual implementations of each supported authentication method can
+ * subclass this base class as required.
* <p>
- * <b>USAGE CONSTRAINT</b>: When this class is utilized, the Context to
- * which it is attached (or a parent Container in a hierarchy) must have an
- * associated Realm that can be used for authenticating users and enumerating
- * the roles to which they have been assigned.
+ * <b>USAGE CONSTRAINT</b>: When this class is utilized, the Context to which
it
+ * is attached (or a parent Container in a hierarchy) must have an associated
+ * Realm that can be used for authenticating users and enumerating the roles to
+ * which they have been assigned.
* <p>
- * <b>USAGE CONSTRAINT</b>: This Valve is only useful when processing HTTP
- * requests. Requests of any other type will simply be passed through.
+ * <b>USAGE CONSTRAINT</b>: This Valve is only useful when processing HTTP
+ * requests. Requests of any other type will simply be passed through.
*
* @author Craig R. McClanahan
*/
@@ -78,8 +77,8 @@ public abstract class AuthenticatorBase
/**
* "Expires" header always set to Date(1), so generate once only
*/
- private static final String DATE_ONE = (new SimpleDateFormat(
- FastHttpDateFormat.RFC1123_DATE, Locale.US)).format(new Date(1));
+ private static final String DATE_ONE = (new
SimpleDateFormat(FastHttpDateFormat.RFC1123_DATE, Locale.US))
+ .format(new Date(1));
/**
* The string manager for this package.
@@ -96,7 +95,6 @@ public abstract class AuthenticatorBase
*/
protected static final String REALM_NAME = "Authentication required";
-
protected static String getRealmName(Context context) {
if (context == null) {
// Very unlikely
@@ -116,15 +114,12 @@ public abstract class AuthenticatorBase
return result;
}
-
-
- //------------------------------------------------------ Constructor
+ // ------------------------------------------------------ Constructor
public AuthenticatorBase() {
super(true);
}
-
// ----------------------------------------------------- Instance Variables
/**
@@ -139,14 +134,12 @@ public abstract class AuthenticatorBase
*/
protected boolean alwaysUseSession = false;
-
/**
- * Should we cache authenticated Principals if the request is part of
- * an HTTP session?
+ * Should we cache authenticated Principals if the request is part of an
+ * HTTP session?
*/
protected boolean cache = true;
-
/**
* Should the session ID, if any, be changed upon a successful
* authentication to prevent a session fixation attack?
@@ -158,10 +151,9 @@ public abstract class AuthenticatorBase
*/
protected Context context = null;
-
/**
- * Flag to determine if we disable proxy caching, or leave the issue
- * up to the webapp developer.
+ * Flag to determine if we disable proxy caching, or leave the issue up to
+ * the webapp developer.
*/
protected boolean disableProxyCaching = true;
@@ -204,24 +196,21 @@ public abstract class AuthenticatorBase
protected SessionIdGeneratorBase sessionIdGenerator = null;
/**
- * The SingleSignOn implementation in our request processing chain,
- * if there is one.
+ * The SingleSignOn implementation in our request processing chain, if
there
+ * is one.
*/
protected SingleSignOn sso = null;
-
// ------------------------------------------------------------- Properties
public boolean getAlwaysUseSession() {
return alwaysUseSession;
}
-
public void setAlwaysUseSession(boolean alwaysUseSession) {
this.alwaysUseSession = alwaysUseSession;
}
-
/**
* Return the cache authenticated Principals flag.
*
@@ -232,17 +221,16 @@ public abstract class AuthenticatorBase
return this.cache;
}
-
/**
* Set the cache authenticated Principals flag.
*
- * @param cache The new cache flag
+ * @param cache
+ * The new cache flag
*/
public void setCache(boolean cache) {
this.cache = cache;
}
-
/**
* Return the Container to which this Valve is attached.
*/
@@ -251,18 +239,17 @@ public abstract class AuthenticatorBase
return this.context;
}
-
/**
* Set the Container to which this Valve is attached.
*
- * @param container The container to which we are attached
+ * @param container
+ * The container to which we are attached
*/
@Override
public void setContainer(Container container) {
if (container != null && !(container instanceof Context)) {
- throw new IllegalArgumentException
- (sm.getString("authenticator.notContext"));
+ throw new
IllegalArgumentException(sm.getString("authenticator.notContext"));
}
super.setContainer(container);
@@ -270,7 +257,6 @@ public abstract class AuthenticatorBase
}
-
/**
* Return the flag that states if we add headers to disable caching by
* proxies.
@@ -285,8 +271,10 @@ public abstract class AuthenticatorBase
/**
* Set the value of the flag that states if we add headers to disable
* caching by proxies.
- * @param nocache <code>true</code> if we add headers to disable proxy
- * caching, <code>false</code> if we leave the headers alone.
+ *
+ * @param nocache
+ * <code>true</code> if we add headers to disable proxy caching,
+ * <code>false</code> if we leave the headers alone.
*/
public void setDisableProxyCaching(boolean nocache) {
disableProxyCaching = nocache;
@@ -307,9 +295,10 @@ public abstract class AuthenticatorBase
* Set the value of the flag that states what headers we add to disable
* proxy caching.
*
- * @param securePagesWithPragma <code>true</code> if we add headers which
- * are incompatible with downloading office documents in IE under SSL but
- * which fix a caching problem in Mozilla.
+ * @param securePagesWithPragma
+ * <code>true</code> if we add headers which are incompatible
+ * with downloading office documents in IE under SSL but which
+ * fix a caching problem in Mozilla.
*/
public void setSecurePagesWithPragma(boolean securePagesWithPragma) {
this.securePagesWithPragma = securePagesWithPragma;
@@ -335,8 +324,7 @@ public abstract class AuthenticatorBase
* authentication, <code>false</code> to do not perform the
* change.
*/
- public void setChangeSessionIdOnAuthentication(
- boolean changeSessionIdOnAuthentication) {
+ public void setChangeSessionIdOnAuthentication(boolean
changeSessionIdOnAuthentication) {
this.changeSessionIdOnAuthentication = changeSessionIdOnAuthentication;
}
@@ -350,18 +338,16 @@ public abstract class AuthenticatorBase
return this.secureRandomClass;
}
-
/**
* Set the secure random number generator class name.
*
- * @param secureRandomClass The new secure random number generator class
- * name
+ * @param secureRandomClass
+ * The new secure random number generator class name
*/
public void setSecureRandomClass(String secureRandomClass) {
this.secureRandomClass = secureRandomClass;
}
-
/**
* Return the secure random number generator algorithm name.
*
@@ -371,18 +357,16 @@ public abstract class AuthenticatorBase
return secureRandomAlgorithm;
}
-
/**
* Set the secure random number generator algorithm name.
*
- * @param secureRandomAlgorithm The new secure random number generator
- * algorithm name
+ * @param secureRandomAlgorithm
+ * The new secure random number generator algorithm name
*/
public void setSecureRandomAlgorithm(String secureRandomAlgorithm) {
this.secureRandomAlgorithm = secureRandomAlgorithm;
}
-
/**
* Return the secure random number generator provider name.
*
@@ -392,38 +376,37 @@ public abstract class AuthenticatorBase
return secureRandomProvider;
}
-
/**
* Set the secure random number generator provider name.
*
- * @param secureRandomProvider The new secure random number generator
- * provider name
+ * @param secureRandomProvider
+ * The new secure random number generator provider name
*/
public void setSecureRandomProvider(String secureRandomProvider) {
this.secureRandomProvider = secureRandomProvider;
}
-
-
// --------------------------------------------------------- Public Methods
/**
* Enforce the security restrictions in the web application deployment
* descriptor of our associated Context.
*
- * @param request Request to be processed
- * @param response Response to be processed
- *
- * @exception IOException if an input/output error occurs
- * @exception ServletException if thrown by a processing element
+ * @param request
+ * Request to be processed
+ * @param response
+ * Response to be processed
+ *
+ * @exception IOException
+ * if an input/output error occurs
+ * @exception ServletException
+ * if thrown by a processing element
*/
@Override
- public void invoke(Request request, Response response)
- throws IOException, ServletException {
+ public void invoke(Request request, Response response) throws IOException,
ServletException {
if (log.isDebugEnabled()) {
- log.debug("Security checking request " +
- request.getMethod() + " " + request.getRequestURI());
+ log.debug("Security checking request " + request.getMethod() + " "
+ request.getRequestURI());
}
// Have we got a cached authenticated Principal to record?
@@ -435,10 +418,8 @@ public abstract class AuthenticatorBase
principal = session.getPrincipal();
if (principal != null) {
if (log.isDebugEnabled()) {
- log.debug("We have cached auth type " +
- session.getAuthType() +
- " for principal " +
- session.getPrincipal());
+ log.debug("We have cached auth type " +
session.getAuthType() + " for principal "
+ + session.getPrincipal());
}
request.setAuthType(session.getAuthType());
request.setUserPrincipal(principal);
@@ -452,11 +433,10 @@ public abstract class AuthenticatorBase
// to which it submits) might be outside the secured area
String contextPath = this.context.getPath();
String decodedRequestURI = request.getDecodedRequestURI();
- if (decodedRequestURI.startsWith(contextPath) &&
- decodedRequestURI.endsWith(Constants.FORM_ACTION)) {
+ if (decodedRequestURI.startsWith(contextPath) &&
decodedRequestURI.endsWith(Constants.FORM_ACTION)) {
if (!authenticate(request, response)) {
if (log.isDebugEnabled()) {
- log.debug(" Failed authenticate() test ??" +
decodedRequestURI );
+ log.debug(" Failed authenticate() test ??" +
decodedRequestURI);
}
return;
}
@@ -467,21 +447,18 @@ public abstract class AuthenticatorBase
// GET which is used after authentication when redirecting to the
// protected resource.
// TODO: This is similar to the FormAuthenticator.matchRequest() logic
- // Is there a way to remove the duplication?
+ // Is there a way to remove the duplication?
Session session = request.getSessionInternal(false);
if (session != null) {
- SavedRequest savedRequest =
- (SavedRequest)
session.getNote(Constants.FORM_REQUEST_NOTE);
- if (savedRequest != null &&
-
decodedRequestURI.equals(savedRequest.getDecodedRequestURI()) &&
- !authenticate(request, response)) {
+ SavedRequest savedRequest = (SavedRequest)
session.getNote(Constants.FORM_REQUEST_NOTE);
+ if (savedRequest != null &&
decodedRequestURI.equals(savedRequest.getDecodedRequestURI())
+ && !authenticate(request, response)) {
if (log.isDebugEnabled()) {
log.debug(" Failed authenticate() test");
}
/*
- * ASSERT: Authenticator already set the appropriate
- * HTTP status code, so we do not have to do anything
- * special
+ * ASSERT: Authenticator already set the appropriate HTTP
status
+ * code, so we do not have to do anything special
*/
return;
}
@@ -496,8 +473,7 @@ public abstract class AuthenticatorBase
Realm realm = this.context.getRealm();
// Is this request URI subject to a security constraint?
- SecurityConstraint [] constraints
- = realm.findSecurityConstraints(request, this.context);
+ SecurityConstraint[] constraints =
realm.findSecurityConstraints(request, this.context);
if (constraints == null && !context.getPreemptiveAuthentication()) {
if (log.isDebugEnabled()) {
@@ -509,8 +485,7 @@ public abstract class AuthenticatorBase
// Make sure that constrained resources are not cached by web proxies
// or browsers as caching can provide a security hole
- if (constraints != null && disableProxyCaching &&
- !"POST".equalsIgnoreCase(request.getMethod())) {
+ if (constraints != null && disableProxyCaching &&
!"POST".equalsIgnoreCase(request.getMethod())) {
if (securePagesWithPragma) {
// Note: These can cause problems with downloading files with
IE
response.setHeader("Pragma", "No-cache");
@@ -527,14 +502,13 @@ public abstract class AuthenticatorBase
if (log.isDebugEnabled()) {
log.debug(" Calling hasUserDataPermission()");
}
- if (!realm.hasUserDataPermission(request, response,
- constraints)) {
+ if (!realm.hasUserDataPermission(request, response, constraints)) {
if (log.isDebugEnabled()) {
log.debug(" Failed hasUserDataPermission() test");
}
/*
- * ASSERT: Authenticator already set the appropriate
- * HTTP status code, so we do not have to do anything special
+ * ASSERT: Authenticator already set the appropriate HTTP
status
+ * code, so we do not have to do anything special
*/
return;
}
@@ -547,14 +521,13 @@ public abstract class AuthenticatorBase
authRequired = false;
} else {
authRequired = true;
- for(i=0; i < constraints.length && authRequired; i++) {
- if(!constraints[i].getAuthConstraint()) {
+ for (i = 0; i < constraints.length && authRequired; i++) {
+ if (!constraints[i].getAuthConstraint()) {
authRequired = false;
break;
- } else if(!constraints[i].getAllRoles() &&
- !constraints[i].getAuthenticatedUsers()) {
- String [] roles = constraints[i].findAuthRoles();
- if(roles == null || roles.length == 0) {
+ } else if (!constraints[i].getAllRoles() &&
!constraints[i].getAuthenticatedUsers()) {
+ String[] roles = constraints[i].findAuthRoles();
+ if (roles == null || roles.length == 0) {
authRequired = false;
break;
}
@@ -563,18 +536,16 @@ public abstract class AuthenticatorBase
}
if (!authRequired && context.getPreemptiveAuthentication()) {
- authRequired =
- request.getCoyoteRequest().getMimeHeaders().getValue(
- "authorization") != null;
+ authRequired =
request.getCoyoteRequest().getMimeHeaders().getValue("authorization") != null;
}
- if (!authRequired && context.getPreemptiveAuthentication() &&
- HttpServletRequest.CLIENT_CERT_AUTH.equals(getAuthMethod())) {
+ if (!authRequired && context.getPreemptiveAuthentication()
+ &&
HttpServletRequest.CLIENT_CERT_AUTH.equals(getAuthMethod())) {
X509Certificate[] certs = getRequestCertificates(request);
authRequired = certs != null && certs.length > 0;
}
- if(authRequired) {
+ if (authRequired) {
if (log.isDebugEnabled()) {
log.debug(" Calling authenticate()");
}
@@ -583,9 +554,8 @@ public abstract class AuthenticatorBase
log.debug(" Failed authenticate() test");
}
/*
- * ASSERT: Authenticator already set the appropriate
- * HTTP status code, so we do not have to do anything
- * special
+ * ASSERT: Authenticator already set the appropriate HTTP
status
+ * code, so we do not have to do anything special
*/
return;
}
@@ -596,16 +566,13 @@ public abstract class AuthenticatorBase
if (log.isDebugEnabled()) {
log.debug(" Calling accessControl()");
}
- if (!realm.hasResourcePermission(request, response,
- constraints,
- this.context)) {
+ if (!realm.hasResourcePermission(request, response, constraints,
this.context)) {
if (log.isDebugEnabled()) {
log.debug(" Failed accessControl() test");
}
/*
- * ASSERT: AccessControl method has already set the
- * appropriate HTTP status code, so we do not have to do
- * anything special
+ * ASSERT: AccessControl method has already set the appropriate
+ * HTTP status code, so we do not have to do anything special
*/
return;
}
@@ -619,7 +586,6 @@ public abstract class AuthenticatorBase
}
-
// ------------------------------------------------------ Protected Methods
/**
@@ -627,16 +593,14 @@ public abstract class AuthenticatorBase
* <code>javax.servlet.request.X509Certificate</code>. If not found,
trigger
* extracting the certificate chain from the Coyote request.
*
- * @param request Request to be processed
+ * @param request
+ * Request to be processed
*
- * @return The X509 certificate chain if found, <code>null</code>
- * otherwise.
+ * @return The X509 certificate chain if found, <code>null</code>
otherwise.
*/
- protected X509Certificate[] getRequestCertificates(final Request request)
- throws IllegalStateException {
+ protected X509Certificate[] getRequestCertificates(final Request request)
throws IllegalStateException {
- X509Certificate certs[] =
- (X509Certificate[])
request.getAttribute(Globals.CERTIFICATES_ATTR);
+ X509Certificate certs[] = (X509Certificate[])
request.getAttribute(Globals.CERTIFICATES_ATTR);
if ((certs == null) || (certs.length < 1)) {
try {
@@ -651,13 +615,14 @@ public abstract class AuthenticatorBase
return certs;
}
-
/**
- * Associate the specified single sign on identifier with the
- * specified Session.
+ * Associate the specified single sign on identifier with the specified
+ * Session.
*
- * @param ssoId Single sign on identifier
- * @param session Session to be associated
+ * @param ssoId
+ * Single sign on identifier
+ * @param session
+ * Session to be associated
*/
protected void associate(String ssoId, Session session) {
@@ -668,39 +633,41 @@ public abstract class AuthenticatorBase
}
-
/**
* Authenticate the user making this request, based on the login
* configuration of the {@link Context} with which this Authenticator is
- * associated. Return <code>true</code> if any specified constraint has
- * been satisfied, or <code>false</code> if we have created a response
- * challenge already.
+ * associated. Return <code>true</code> if any specified constraint has
been
+ * satisfied, or <code>false</code> if we have created a response challenge
+ * already.
+ *
+ * @param request
+ * Request we are processing
+ * @param response
+ * Response we are populating
*
- * @param request Request we are processing
- * @param response Response we are populating
- *
- * @exception IOException if an input/output error occurs
+ * @exception IOException
+ * if an input/output error occurs
*/
@Override
- public abstract boolean authenticate(Request request,
- HttpServletResponse response) throws IOException;
-
+ public abstract boolean authenticate(Request request, HttpServletResponse
response) throws IOException;
/**
* Check to see if the user has already been authenticated earlier in the
* processing chain or if there is enough information available to
* authenticate the user without requiring further user interaction.
*
- * @param request The current request
- * @param response The current response
- * @param useSSO Should information available from SSO be used to attempt
- * to authenticate the current user?
+ * @param request
+ * The current request
+ * @param response
+ * The current response
+ * @param useSSO
+ * Should information available from SSO be used to attempt to
+ * authenticate the current user?
*
* @return <code>true</code> if the user was authenticated via the cache,
* otherwise <code>false</code>
*/
- protected boolean checkForCachedAuthentication(Request request,
- HttpServletResponse response, boolean useSSO) {
+ protected boolean checkForCachedAuthentication(Request request,
HttpServletResponse response, boolean useSSO) {
// Has the user already been authenticated?
Principal principal = request.getUserPrincipal();
@@ -723,12 +690,14 @@ public abstract class AuthenticatorBase
if (log.isDebugEnabled()) {
log.debug(sm.getString("authenticator.check.sso", ssoId));
}
- /* Try to reauthenticate using data cached by SSO. If this fails,
- either the original SSO logon was of DIGEST or SSL (which
- we can't reauthenticate ourselves because there is no
- cached username and password), or the realm denied
- the user's reauthentication for some reason.
- In either case we have to prompt the user for a logon */
+ /*
+ * Try to reauthenticate using data cached by SSO. If this fails,
+ * either the original SSO logon was of DIGEST or SSL (which we
+ * can't reauthenticate ourselves because there is no cached
+ * username and password), or the realm denied the user's
+ * reauthentication for some reason. In either case we have to
+ * prompt the user for a logon
+ */
if (reauthenticateFromSSO(ssoId, request)) {
return true;
}
@@ -749,7 +718,7 @@ public abstract class AuthenticatorBase
if (log.isDebugEnabled()) {
log.debug(sm.getString("authenticator.check.authorizeFail", username));
}
- authorized = new GenericPrincipal(username, null, null);
+ authorized = new GenericPrincipal(username, null, null);
}
String authType = request.getAuthType();
if (authType == null || authType.length() == 0) {
@@ -762,14 +731,15 @@ public abstract class AuthenticatorBase
return false;
}
-
/**
- * Attempts reauthentication to the <code>Realm</code> using
- * the credentials included in argument <code>entry</code>.
+ * Attempts reauthentication to the <code>Realm</code> using the
credentials
+ * included in argument <code>entry</code>.
*
- * @param ssoId identifier of SingleSignOn session with which the
- * caller is associated
- * @param request the request that needs to be authenticated
+ * @param ssoId
+ * identifier of SingleSignOn session with which the caller is
+ * associated
+ * @param request
+ * the request that needs to be authenticated
* @return <code>true</code> if the reauthentication from SSL occurred
*/
protected boolean reauthenticateFromSSO(String ssoId, Request request) {
@@ -792,37 +762,39 @@ public abstract class AuthenticatorBase
associate(ssoId, request.getSessionInternal(true));
if (log.isDebugEnabled()) {
- log.debug(" Reauthenticated cached principal '" +
- request.getUserPrincipal().getName() +
- "' with auth type '" + request.getAuthType() + "'");
+ log.debug(" Reauthenticated cached principal '" +
request.getUserPrincipal().getName()
+ + "' with auth type '" + request.getAuthType() + "'");
}
}
return reauthenticated;
}
-
/**
* Register an authenticated Principal and authentication type in our
* request, in the current session (if there is one), and with our
- * SingleSignOn valve, if there is one. Set the appropriate cookie
- * to be returned.
+ * SingleSignOn valve, if there is one. Set the appropriate cookie to be
+ * returned.
*
- * @param request The servlet request we are processing
- * @param response The servlet response we are generating
- * @param principal The authenticated Principal to be registered
- * @param authType The authentication type to be registered
- * @param username Username used to authenticate (if any)
- * @param password Password used to authenticate (if any)
- */
- public void register(Request request, HttpServletResponse response,
- Principal principal, String authType,
- String username, String password) {
+ * @param request
+ * The servlet request we are processing
+ * @param response
+ * The servlet response we are generating
+ * @param principal
+ * The authenticated Principal to be registered
+ * @param authType
+ * The authentication type to be registered
+ * @param username
+ * Username used to authenticate (if any)
+ * @param password
+ * Password used to authenticate (if any)
+ */
+ public void register(Request request, HttpServletResponse response,
Principal principal, String authType,
+ String username, String password) {
if (log.isDebugEnabled()) {
String name = (principal == null) ? "none" : principal.getName();
- log.debug("Authenticated '" + name + "' with type '" + authType +
- "'");
+ log.debug("Authenticated '" + name + "' with type '" + authType +
"'");
}
// Cache the authentication information in our request
@@ -841,8 +813,7 @@ public abstract class AuthenticatorBase
manager.changeSessionId(session);
request.changeSessionId(session.getId());
if (log.isDebugEnabled()) {
- log.debug(sm.getString("authenticator.changeSessionId",
- oldId, session.getId()));
+ log.debug(sm.getString("authenticator.changeSessionId",
oldId, session.getId()));
}
}
} else if (alwaysUseSession) {
@@ -888,13 +859,14 @@ public abstract class AuthenticatorBase
// Bugzilla 34724
String ssoDomain = sso.getCookieDomain();
- if(ssoDomain != null) {
+ if (ssoDomain != null) {
cookie.setDomain(ssoDomain);
}
- // Configure httpOnly on SSO cookie using same rules as session
cookies
- if
(request.getServletContext().getSessionCookieConfig().isHttpOnly() ||
- request.getContext().getUseHttpOnly()) {
+ // Configure httpOnly on SSO cookie using same rules as session
+ // cookies
+ if
(request.getServletContext().getSessionCookieConfig().isHttpOnly()
+ || request.getContext().getUseHttpOnly()) {
cookie.setHttpOnly(true);
}
@@ -930,11 +902,9 @@ public abstract class AuthenticatorBase
}
@Override
- public void login(String username, String password, Request request)
- throws ServletException {
+ public void login(String username, String password, Request request)
throws ServletException {
Principal principal = doLogin(request, username, password);
- register(request, request.getResponse(), principal,
- getAuthMethod(), username, password);
+ register(request, request.getResponse(), principal, getAuthMethod(),
username, password);
}
protected abstract String getAuthMethod();
@@ -942,15 +912,17 @@ public abstract class AuthenticatorBase
/**
* Process the login request.
*
- * @param request Associated request
- * @param username The user
- * @param password The password
- * @return The authenticated Principal
- * @throws ServletException No principal was authenticated with
- * the specified credentials
+ * @param request
+ * Associated request
+ * @param username
+ * The user
+ * @param password
+ * The password
+ * @return The authenticated Principal
+ * @throws ServletException
+ * No principal was authenticated with the specified
credentials
*/
- protected Principal doLogin(Request request, String username,
- String password) throws ServletException {
+ protected Principal doLogin(Request request, String username, String
password) throws ServletException {
Principal p = context.getRealm().authenticate(username, password);
if (p == null) {
throw new
ServletException(sm.getString("authenticator.loginFail"));
@@ -960,17 +932,17 @@ public abstract class AuthenticatorBase
@Override
public void logout(Request request) {
- register(request, request.getResponse(), null,
- null, null, null);
+ register(request, request.getResponse(), null, null, null, null);
}
/**
- * Start this component and implement the requirements
- * of {@link org.apache.catalina.util.LifecycleBase#startInternal()}.
+ * Start this component and implement the requirements of
+ * {@link org.apache.catalina.util.LifecycleBase#startInternal()}.
*
- * @exception LifecycleException if this component detects a fatal error
- * that prevents this component from being used
+ * @exception LifecycleException
+ * if this component detects a fatal error that prevents
this
+ * component from being used
*/
@Override
protected synchronized void startInternal() throws LifecycleException {
@@ -1006,13 +978,13 @@ public abstract class AuthenticatorBase
super.startInternal();
}
-
/**
- * Stop this component and implement the requirements
- * of {@link org.apache.catalina.util.LifecycleBase#stopInternal()}.
+ * Stop this component and implement the requirements of
+ * {@link org.apache.catalina.util.LifecycleBase#stopInternal()}.
*
- * @exception LifecycleException if this component detects a fatal error
- * that prevents this component from being used
+ * @exception LifecycleException
+ * if this component detects a fatal error that prevents
this
+ * component from being used
*/
@Override
protected synchronized void stopInternal() throws LifecycleException {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]