public class HttpDigestAuthenticationHandler extends AuthenticationHandler
In order to use this handler YOU MUST perform the following operation :
   
    Member mbr = ...;
    Member updated = (Member) mbr.getUpdateInstance();
    updated.setExtraDataMap(Util.getHashMap(mbr.getExtraDataMap()));
    HttpDigestAuthenticationHandler.putHA1InMemberExtraData(updated, "MyRealm", "The member's clear text password");
    updated.performUpdate(admin);
   
   Note : building the HA1 requires the clear text password of the user but the password is NOT saved (see explanation below).
  setHttpDigestAuthorizationHeader(HttpSession, HttpServletResponse, String).
    <%@ include file="/jcore/doInitPage.jspf" %><% 
    %><%@ page import="com.jalios.jcms.authentication.handlers.HttpDigestAuthenticationHandler" %><%
 
     if (loggedMember == null) {
       HttpDigestAuthenticationHandler.setHttpDigestAuthorizationHeader(session, response, "MyRealm");
       return;
     }
    %>
   
  
 HA1 explanation:  : HTTP Digest authentication requires either
 the password in clear text form (we definitely do not want that)
 or the hash HA1 (md5(user:realm:clear-text-password)) on the server side.
 That's why the HA1 MUST be saved from the clear text password of the Member
 when it's available (for example using a DataController when editing its profile).
 
More informations on Digest authentication can be found here :
| Modifier and Type | Field and Description | 
|---|---|
static int | 
ORDER_DIGEST_HTTP_HANDLER
Order used by the HttpDigestAuthenticationHandler 
 | 
static java.lang.String | 
REVISION  | 
channel, GENERIC_BAD_AUTHENTICATION_MSG| Modifier and Type | Method and Description | 
|---|---|
static Member | 
checkAuthenticationFromHTTPAuthorization(javax.servlet.http.HttpServletRequest request)
Returns the member corresponding to the HTTP Authorization header
 available in the request. 
 | 
static java.lang.String | 
getDefaultRealm()
Retrieve the default REALM used for HTTP Digest authentication. 
 | 
static java.lang.String | 
getExtraDataKey(java.lang.String realm)
Retrieve the ExtraData key used to store the HASH HA1 for the specified realm 
 | 
static java.lang.String | 
getHA1(Member member,
      java.lang.String realm,
      java.lang.String clearTextPassword)
Compute and retrieve the HASH key HA1 for the specified parameters 
 | 
static java.lang.String | 
getHA1FromMemberExtraData(Member member,
                         java.lang.String realm)
Retrieve the previously stored HASH key HA1 frm the member's ExtraData (or ExtraDBData for DBMember) 
 | 
static java.lang.String | 
getHA2(javax.servlet.http.HttpServletRequest request)
Compute and retrieve the HASH key HA2 for the specified request 
 | 
static HttpDigestAuthenticationHandler | 
getInstance()  | 
void | 
loadProperties()
This method will be called by the AuthenticationManager each time the
 Channel properties are loaded/reloaded. 
You can use it to reload properties that might have been changed. This method is called during initialization of the AuthenticationManager  | 
void | 
login(AuthenticationContext ctxt)
Authenticate a member. 
 | 
static void | 
putHA1InMemberExtraData(Member member,
                       java.lang.String realm,
                       java.lang.String clearTextPassword)
Compute and add the HASH key HA1 in the member's ExtraData (or ExtraDBData for DBMember) 
 | 
static java.lang.String | 
removeSurroundingQuote(java.lang.String str)  | 
static void | 
setHttpDigestAuthorizationHeader(javax.servlet.http.HttpSession session,
                                javax.servlet.http.HttpServletResponse response,
                                java.lang.String realm)
Set a 401 status code (UNAUTHORIZED) and add the "WWW-Authenticate"
 header to the given response using the given realm. 
 | 
public static final java.lang.String REVISION
public static final int ORDER_DIGEST_HTTP_HANDLER
public static final HttpDigestAuthenticationHandler getInstance()
public void loadProperties()
AuthenticationHandlerloadProperties in class AuthenticationHandlerpublic void login(AuthenticationContext ctxt) throws java.io.IOException
AuthenticationHandlerAuthenticationContext object (request, response, login.. etc) AuthenticationContext.setLoggedMember(com.jalios.jcms.Member)AuthenticationContext.doChain(),AuthenticationContext.login in class AuthenticationHandlerctxt - the AuthenticationContext used for this loginjava.io.IOExceptionpublic static final Member checkAuthenticationFromHTTPAuthorization(javax.servlet.http.HttpServletRequest request) throws java.io.IOException
request - the request where to look for HTTP Authorization headerjava.io.IOException - if the underneath login operation with the userId/password could not be performedpublic static java.lang.String removeSurroundingQuote(java.lang.String str)
public static final void setHttpDigestAuthorizationHeader(javax.servlet.http.HttpSession session,
                                                          javax.servlet.http.HttpServletResponse response,
                                                          java.lang.String realm)
session - the current session being used for authenticationresponse - the HttpServletResponse of which to set status and add headerrealm - the Realm to set in the responsepublic static java.lang.String getHA1(Member member, java.lang.String realm, java.lang.String clearTextPassword)
member - the member for which the HASH is generatedrealm - the HASH realmclearTextPassword - the member's clear text passwordpublic static void putHA1InMemberExtraData(Member member, java.lang.String realm, java.lang.String clearTextPassword)
member - the member for which hash is setrealm - the HASH realmclearTextPassword - the clear text password of the user, REQUIREDpublic static java.lang.String getHA1FromMemberExtraData(Member member, java.lang.String realm)
member - the member for which hash is retrievedrealm - the HASH realmpublic static java.lang.String getExtraDataKey(java.lang.String realm)
realm - the realmpublic static java.lang.String getHA2(javax.servlet.http.HttpServletRequest request)
request - the HttpServletRequest for which the HA2 is being generatedpublic static java.lang.String getDefaultRealm()
Copyright © 2001-2018 Jalios SA. All Rights Reserved.