Interface AuthenticationHandler
- All Known Implementing Classes:
AbstractAuthenticationHandler
AuthenticationHandler interface defines the service API used
by the authentication implementation to support plugin various ways of
extracting credentials from the request.
Important: This interface is deprecated. UseJakartaAuthenticationHandlerinstead. This interface is not directly marked as deprecated as the inner enumAuthenticationHandler.FAILURE_REASON_CODESis not deprecated! This interface is deprecated since package version 1.3.0.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic enumThis enum indicates the supported detailed login failure reason codes:invalid_login: indicates username/password mismatch.password_expired: indicates password has expired or was never set and change initial password is enabledaccount_locked: the account was disabled or lockedaccount_not_found: the account was not found (not the same as username password mismatch)expired_token: the token credentials used have expired -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoiddropCredentials(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) Deprecated.extractCredentials(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) Deprecated.booleanrequestCredentials(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) Deprecated.
-
Field Details
-
SERVICE_NAME
Deprecated.The name under which an implementation of this interface must be registered to be used as an authentication handler.- See Also:
-
PATH_PROPERTY
Deprecated.The name of the service registration property listing one or more URL paths for which the authentication handler is to be used. The property may be a single string value or an array of strings or a Collection of strings.Each string value may either be an absolute path (e.g. /content) or an absolute URL (e.g. http://thehost/content) to assign the authentication handler to authenticate request for a select virtual host.
Authentication handlers without a
pathservice registration property are ignored.- See Also:
-
TYPE_PROPERTY
Deprecated.The name of the service registration property (single string) providing the authentication type of authentication handler. This is the same value as will be returned as theauthentication typereturned by theextractCredentials(HttpServletRequest, HttpServletResponse)method.This property is optional but allows the client to optionally select the authentication handler which will actually request credentials upon the
requestCredentials(HttpServletRequest, HttpServletResponse)method.- See Also:
-
REQUEST_LOGIN_PARAMETER
Deprecated.The request parameter which may be used to explicitly select an authentication handler by itstypeif authentication will be requested throughrequestCredentials(HttpServletRequest, HttpServletResponse). -
FAILURE_REASON
Deprecated.Name of the request attribute which may be set by theextractCredentials(HttpServletRequest, HttpServletResponse)method ifAuthenticationInfo.FAIL_AUTHis returned.This result may be used by authentication handlers to inform the user of any failures.
- Since:
- 1.0.2 (Bundle version 1.0.4)
- See Also:
-
FAILURE_REASON_CODE
Deprecated.Name of the request attribute which may be set by theextractCredentials(HttpServletRequest, HttpServletResponse)method ifAuthenticationInfo.FAIL_AUTHis returned.This result may be used by authentication handlers to inform the user of more detailed failure reasons, e.g. "password_expired".
- Since:
- 1.1.0
- See Also:
-
-
Method Details
-
extractCredentials
@Deprecated(since="1.3.0") AuthenticationInfo extractCredentials(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) Deprecated.Extracts credential data from the request if at all contained.The method returns any of the following values :
Extracted Information value description nullno user details were contained in the request or the handler is not capable or willing to extract credentials from the request AuthenticationInfo.DOING_AUTHthe handler is in an ongoing authentication transaction with the client. Request processing should be aborted at this stage. AuthenticationInfo.FAIL_AUTHthe handler failed extracting the credentials from the request for any reason. An example of this result is that credentials are present in the request but they could not be validated and thus not be used for request processing. When returning this value, the authentication handler may also set the FAILURE_REASONrequest attribute to inform interested parties (including its ownrequestCredentials(HttpServletRequest, HttpServletResponse)method for the reasons of failure to extract the credentials.AuthenticationInfoobjectThe user sent credentials. The returned object contains the credentials as well as the type of authentication transmission employed. The method must not request credential information from the client, if they are not found in the request.
The value of
PATH_PROPERTYservice registration property value triggering this call is available as thepathrequest attribute. If the service is registered with multiple path values, the value of thepathrequest attribute may be used to implement specific handling.- Parameters:
request- The request object containing the information for the authentication.response- The response object which may be used to send the information on the request failure to the user.- Returns:
- A valid
AuthenticationInfoinstance identifying the request user,AuthenticationInfo.DOING_AUTHif the handler is in an authentication transaction with the client or null if the request does not contain authentication information. In case ofAuthenticationInfo.DOING_AUTH, the method must have sent a response indicating that fact to the client.
-
requestCredentials
@Deprecated(since="1.3.0") boolean requestCredentials(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws IOException Deprecated.Requests authentication information from the client. Returnstrueif the information has been requested and request processing can be terminated normally. Otherwise the authorization information could not be requested.The
HttpServletResponse.sendErrormethods should not be used by the implementation because these responses might be post-processed by the servlet container's error handling infrastructure thus preventing the correct operation of the authentication handler. To convey a HTTP response status theHttpServletResponse.setStatusmethod should be used.The value of
PATH_PROPERTYservice registration property value triggering this call is available as thepathrequest attribute. If the service is registered with multiple path values, the value of thepathrequest attribute may be used to implement specific handling.If the
REQUEST_LOGIN_PARAMETERrequest parameter is set only those authentication handlers registered with anauthentication typematching the parameter will be considered for requesting credentials through this method.A handler not registered with an
authentication typewill, for backwards compatibility reasons, always be called ignoring the actual value of theREQUEST_LOGIN_PARAMETERparameter.- Parameters:
request- The request object.response- The response object to which to send the request.- Returns:
trueif the handler is able to send an authentication inquiry for the given request.falseotherwise.- Throws:
IOException- If an error occurs sending the authentication inquiry to the client.
-
dropCredentials
@Deprecated(since="1.3.0") void dropCredentials(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws IOException Deprecated.Drops any credential and authentication details from the request and asks the client to do the same.- Parameters:
request- The request object.response- The response object to which to send the request.- Throws:
IOException- If an error occurs asking the client to drop any authentication traces.
-
JakartaAuthenticationHandler