public class FormAuthenticationHandler
extends org.apache.sling.auth.core.spi.DefaultAuthenticationFeedbackHandler
implements org.apache.sling.auth.core.spi.AuthenticationHandler
FormAuthenticationHandler
class implements the authorization
steps based on a cookie.Constructor and Description |
---|
FormAuthenticationHandler() |
Modifier and Type | Method and Description |
---|---|
protected void |
activate(FormAuthenticationHandlerConfig config,
org.osgi.service.component.ComponentContext componentContext)
Called by SCR to activate the authentication handler.
|
void |
authenticationFailed(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
org.apache.sling.auth.core.spi.AuthenticationInfo authInfo)
Called after an unsuccessful login attempt.
|
boolean |
authenticationSucceeded(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
org.apache.sling.auth.core.spi.AuthenticationInfo authInfo)
Called after successful login with the given authentication info.
|
protected void |
deactivate() |
void |
dropCredentials(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Clears all authentication state which might have been prepared by this
authentication handler.
|
org.apache.sling.auth.core.spi.AuthenticationInfo |
extractCredentials(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Extracts cookie/session based credentials from the request.
|
boolean |
isValid(javax.jcr.Credentials credentials) |
boolean |
requestCredentials(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Unless the
sling:authRequestLogin to anything other than
Form this method either sends back a 403/FORBIDDEN response if
the j_verify parameter is set to true or redirects
to the login form to ask for credentials. |
String |
toString() |
public org.apache.sling.auth.core.spi.AuthenticationInfo extractCredentials(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
null
if the handler assumes HTTP Basic authentication would be
more appropriate, if no form fields are present in the request and if the
secure user data is not present either in the cookie or an HTTP Session.extractCredentials
in interface org.apache.sling.auth.core.spi.AuthenticationHandler
public boolean requestCredentials(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws IOException
sling:authRequestLogin
to anything other than
Form
this method either sends back a 403/FORBIDDEN response if
the j_verify
parameter is set to true
or redirects
to the login form to ask for credentials.
This method assumes the j_verify
request parameter to only be
set in the initial username/password submission through the login form. No
further checks are applied, though, before sending back the 403/FORBIDDEN
response.
requestCredentials
in interface org.apache.sling.auth.core.spi.AuthenticationHandler
IOException
public void dropCredentials(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
dropCredentials
in interface org.apache.sling.auth.core.spi.AuthenticationHandler
public void authenticationFailed(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, org.apache.sling.auth.core.spi.AuthenticationInfo authInfo)
authenticationFailed
in interface org.apache.sling.auth.core.spi.AuthenticationFeedbackHandler
authenticationFailed
in class org.apache.sling.auth.core.spi.DefaultAuthenticationFeedbackHandler
public boolean authenticationSucceeded(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, org.apache.sling.auth.core.spi.AuthenticationInfo authInfo)
If no authentication data already exists, it is created. Otherwise if the data has expired the data is updated with a new security token and a new expiry time.
If creating or updating the authentication data fails, it is actually removed from the cookie or the HTTP session and future requests will not be authenticated any longer.
authenticationSucceeded
in interface org.apache.sling.auth.core.spi.AuthenticationFeedbackHandler
authenticationSucceeded
in class org.apache.sling.auth.core.spi.DefaultAuthenticationFeedbackHandler
public boolean isValid(javax.jcr.Credentials credentials)
protected void activate(FormAuthenticationHandlerConfig config, org.osgi.service.component.ComponentContext componentContext) throws InvalidKeyException, NoSuchAlgorithmException, IllegalStateException, UnsupportedEncodingException
protected void deactivate()
Copyright © 2007–2019 The Apache Software Foundation. All rights reserved.