@Service
@Properties(value={@Property(name="service.vendor",value="The Apache Software Foundation"),@Property(name="service.description",value="Apache Sling OpenID Authentication Handler"),@Property(name="path",value="/",unbounded=ARRAY),@Property(name="authtype",value="OpenID",propertyPrivate=true)})
public class OpenIDAuthenticationHandler
extends org.apache.sling.auth.core.spi.AbstractAuthenticationHandler
AuthorizationHeaderAuthenticationHandler
class implements
the authorization steps based on the Authorization header of the HTTP
request. This authenticator should eventually support both BASIC and DIGEST
authentication methods.Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_COOKIE_DOMAIN |
static String |
DEFAULT_COOKIE_NAME |
static String |
DEFAULT_COOKIE_SECRET_KEY |
static String |
DEFAULT_EXTERNAL_URL_PREFIX |
static String |
DEFAULT_LOGIN_IDENTIFIER_FORM_FIELD |
static boolean |
DEFAULT_USE_COOKIE |
static String |
PROP_COOKIE_DOMAIN |
static String |
PROP_COOKIE_NAME |
static String |
PROP_COOKIE_SECRET_KEY |
static String |
PROP_EXTERNAL_URL_PREFIX |
static String |
PROP_LOGIN_FORM |
static String |
PROP_LOGIN_IDENTIFIER_FORM_FIELD |
static String |
PROP_USE_COOKIE |
Constructor and Description |
---|
OpenIDAuthenticationHandler() |
Modifier and Type | Method and Description |
---|---|
protected void |
activate(org.osgi.service.component.ComponentContext componentContext) |
void |
authenticationFailed(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
org.apache.sling.auth.core.spi.AuthenticationInfo authInfo) |
boolean |
authenticationSucceeded(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
org.apache.sling.auth.core.spi.AuthenticationInfo authInfo) |
protected void |
deactivate(org.osgi.service.component.ComponentContext componentContext) |
void |
dropCredentials(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Invalidates the request with the Relying Party if a user is actually
available for the request.
|
org.apache.sling.auth.core.spi.AuthenticationInfo |
extractCredentials(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Extracts credential data from the request if at all contained.
|
boolean |
requestCredentials(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Sends status
401 (Unauthorized) with a
WWW-Authenticate requesting standard HTTP header
authentication with the Basic scheme and the configured
realm name. |
getAttributeOrParameter, getLoginResource, isRedirectValid, isValidateRequest, sendInvalid, sendRedirect, sendValid, setLoginResourceAttribute
@Property(value="/system/sling/openid/login") public static final String PROP_LOGIN_FORM
public static final String DEFAULT_LOGIN_IDENTIFIER_FORM_FIELD
@Property(value="openid_identifier") public static final String PROP_LOGIN_IDENTIFIER_FORM_FIELD
public static final String DEFAULT_EXTERNAL_URL_PREFIX
@Property(value="") public static final String PROP_EXTERNAL_URL_PREFIX
public static final boolean DEFAULT_USE_COOKIE
@Property(boolValue=true) public static final String PROP_USE_COOKIE
public static final String DEFAULT_COOKIE_DOMAIN
@Property(value="") public static final String PROP_COOKIE_DOMAIN
public static final String DEFAULT_COOKIE_NAME
@Property(value="sling.openid") public static final String PROP_COOKIE_NAME
public static final String DEFAULT_COOKIE_SECRET_KEY
@Property(value="secret") public static final String PROP_COOKIE_SECRET_KEY
public org.apache.sling.auth.core.spi.AuthenticationInfo extractCredentials(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
The method returns any of the following values :
value | description |
---|---|
null
| no user details were contained in the request |
AuthenticationInfo.DOING_AUTH
| the handler is in an ongoing authentication exchange with the client. The request handling is terminated. |
valid credentials | The user sent credentials. |
The method must not request credential information from the client, if they are not found in the request.
Note : The implementation should pay special attention to the fact, that the request may be for an included servlet, in which case the values for some URI specific values are contained in javax.servlet.include.* request attributes.
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.public boolean requestCredentials(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws IOException
401
(Unauthorized) with a
WWW-Authenticate
requesting standard HTTP header
authentication with the Basic
scheme and the configured
realm name. If the response is already committed, an error message is
logged but the 401 status is not sent.request
- The request objectresponse
- The response object to which to send the requesttrue
is always returned by this handlerIOException
- if an error occurs sending back the response.public void dropCredentials(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
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)
authenticationSucceeded
in interface org.apache.sling.auth.core.spi.AuthenticationFeedbackHandler
authenticationSucceeded
in class org.apache.sling.auth.core.spi.DefaultAuthenticationFeedbackHandler
protected void activate(org.osgi.service.component.ComponentContext componentContext)
protected void deactivate(org.osgi.service.component.ComponentContext componentContext)
Copyright © 2007–2014 The Apache Software Foundation. All rights reserved.