com.dyuproject.web.auth
Class DigestAuthentication

java.lang.Object
  extended by com.dyuproject.web.auth.Authentication
      extended by com.dyuproject.web.auth.DigestAuthentication
Direct Known Subclasses:
SmartDigestAuthentication

public class DigestAuthentication
extends Authentication

Web authorization using MD5 digest.

Author:
David Yu

Field Summary
static String TYPE
           
 
Fields inherited from class com.dyuproject.web.auth.Authentication
AUTHORIZATION, PASSWORD, REALM, USERNAME, WWW_AUTHENTICATE
 
Constructor Summary
DigestAuthentication(CredentialSource credentialSource)
           
 
Method Summary
 boolean authenticate(String realm, HttpServletRequest request, HttpServletResponse response)
           
protected  boolean check(String username, String password, String realm, String nonce, String nc, String cnonce, String qop, String uri, String response, HttpServletRequest request)
           
 String getType()
           
protected  String newNonce(HttpServletRequest request)
           
protected  void sendChallenge(String realm, HttpServletRequest request, HttpServletResponse response)
           
 
Methods inherited from class com.dyuproject.web.auth.Authentication
getCredentialSource, setCredentialSource
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TYPE

public static final String TYPE
See Also:
Constant Field Values
Constructor Detail

DigestAuthentication

public DigestAuthentication(CredentialSource credentialSource)
Method Detail

getType

public String getType()
Specified by:
getType in class Authentication

authenticate

public boolean authenticate(String realm,
                            HttpServletRequest request,
                            HttpServletResponse response)
                     throws ServletException,
                            IOException
Specified by:
authenticate in class Authentication
Throws:
ServletException
IOException

check

protected boolean check(String username,
                        String password,
                        String realm,
                        String nonce,
                        String nc,
                        String cnonce,
                        String qop,
                        String uri,
                        String response,
                        HttpServletRequest request)

sendChallenge

protected void sendChallenge(String realm,
                             HttpServletRequest request,
                             HttpServletResponse response)
                      throws ServletException,
                             IOException
Throws:
ServletException
IOException

newNonce

protected String newNonce(HttpServletRequest request)


Copyright © 2013. All Rights Reserved.