org.mailster.pop3.commands.auth
Class AuthDigestMD5Command

java.lang.Object
  extended by org.mailster.pop3.commands.Pop3Command
      extended by org.mailster.pop3.commands.MultiStatePop3Command
          extended by org.mailster.pop3.commands.auth.AuthAlgorithmCommand
              extended by org.mailster.pop3.commands.auth.AuthDigestMD5Command

public class AuthDigestMD5Command
extends AuthAlgorithmCommand

---
Mailster (C) 2007-2009 De Oliveira Edouard

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

See  Mailster Web Site
---

AuthDigestMD5Command.java - A class supporting the POP3 AUTH DIGEST-MD5 command (see RFC 2831).

Version:
$Revision: 1.10 $, $Date: 2009/02/03 00:29:30 $
Author:
Edouard De Oliveira

Field Summary
static java.lang.String A1
           
static java.lang.String CLIENT_MAXBUF
           
private static int DEFAULT_MAXBUF
           
private static java.lang.String DIRECTIVES_MAP
           
static java.lang.String ENCODING
           
private static int GET_CLIENT_ACK_STATE
           
private static int GET_CLIENT_ACK_WITH_INTEGRITY_QOP_STATE
           
private static int GET_CLIENT_ACK_WITH_PRIVACY_QOP_STATE
           
static java.lang.String INTEGRITY_QOP
           
private static MD5 md5
           
static java.lang.String NEGOCIATED_CIPHER
           
static java.lang.String PRIVACY_QOP
           
private static java.security.SecureRandom rnd
           
private static java.lang.String[] SUPPORTED_QOPS
           
 
Fields inherited from class org.mailster.pop3.commands.auth.AuthAlgorithmCommand
CHECK_RESPONSE_TO_CHALLENGE_STATE
 
Constructor Summary
AuthDigestMD5Command()
           
 
Method Summary
 Pop3CommandState challengeClient(AbstractPop3Handler handler, AbstractPop3Connection conn, java.lang.String cmd)
           
 Pop3CommandState checkClientResponse(AbstractPop3Handler handler, AbstractPop3Connection conn, java.lang.String cmd)
           
private  void computeA1(org.apache.mina.core.session.IoSession session, java.util.HashMap<java.lang.String,java.lang.String> map, java.lang.String pwd, java.lang.String encoding)
           
private  java.lang.String computeResponseValue(org.apache.mina.core.session.IoSession session, java.util.HashMap<java.lang.String,java.lang.String> map, boolean isResponseAuth)
           
 Pop3CommandState execute(AbstractPop3Handler handler, AbstractPop3Connection conn, java.lang.String cmd, Pop3CommandState state)
          Executes the command.
private  java.lang.String getDirectiveValue(java.util.HashMap<java.lang.String,java.lang.String> directivesMap, java.lang.String directive, boolean mandatory)
           
 boolean isSecuredAuthenticationMethod()
           
 
Methods inherited from class org.mailster.pop3.commands.auth.AuthAlgorithmCommand
isValidForState
 
Methods inherited from class org.mailster.pop3.commands.MultiStatePop3Command
execute
 
Methods inherited from class org.mailster.pop3.commands.Pop3Command
tryLockingMailbox
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_MAXBUF

private static final int DEFAULT_MAXBUF
See Also:
Constant Field Values

DIRECTIVES_MAP

private static final java.lang.String DIRECTIVES_MAP

ENCODING

public static final java.lang.String ENCODING

A1

public static final java.lang.String A1

INTEGRITY_QOP

public static final java.lang.String INTEGRITY_QOP

PRIVACY_QOP

public static final java.lang.String PRIVACY_QOP

CLIENT_MAXBUF

public static final java.lang.String CLIENT_MAXBUF

NEGOCIATED_CIPHER

public static final java.lang.String NEGOCIATED_CIPHER

GET_CLIENT_ACK_STATE

private static final int GET_CLIENT_ACK_STATE
See Also:
Constant Field Values

GET_CLIENT_ACK_WITH_INTEGRITY_QOP_STATE

private static final int GET_CLIENT_ACK_WITH_INTEGRITY_QOP_STATE
See Also:
Constant Field Values

GET_CLIENT_ACK_WITH_PRIVACY_QOP_STATE

private static final int GET_CLIENT_ACK_WITH_PRIVACY_QOP_STATE
See Also:
Constant Field Values

rnd

private static java.security.SecureRandom rnd

md5

private static MD5 md5

SUPPORTED_QOPS

private static final java.lang.String[] SUPPORTED_QOPS
Constructor Detail

AuthDigestMD5Command

public AuthDigestMD5Command()
Method Detail

getDirectiveValue

private java.lang.String getDirectiveValue(java.util.HashMap<java.lang.String,java.lang.String> directivesMap,
                                           java.lang.String directive,
                                           boolean mandatory)
                                    throws AuthException
Throws:
AuthException

computeA1

private void computeA1(org.apache.mina.core.session.IoSession session,
                       java.util.HashMap<java.lang.String,java.lang.String> map,
                       java.lang.String pwd,
                       java.lang.String encoding)
                throws AuthException,
                       java.io.UnsupportedEncodingException
Throws:
AuthException
java.io.UnsupportedEncodingException

computeResponseValue

private java.lang.String computeResponseValue(org.apache.mina.core.session.IoSession session,
                                              java.util.HashMap<java.lang.String,java.lang.String> map,
                                              boolean isResponseAuth)
                                       throws AuthException
Throws:
AuthException

isSecuredAuthenticationMethod

public boolean isSecuredAuthenticationMethod()
Overrides:
isSecuredAuthenticationMethod in class AuthAlgorithmCommand

challengeClient

public Pop3CommandState challengeClient(AbstractPop3Handler handler,
                                        AbstractPop3Connection conn,
                                        java.lang.String cmd)
                                 throws java.lang.Exception
Specified by:
challengeClient in class AuthAlgorithmCommand
Throws:
java.lang.Exception

checkClientResponse

public Pop3CommandState checkClientResponse(AbstractPop3Handler handler,
                                            AbstractPop3Connection conn,
                                            java.lang.String cmd)
                                     throws java.lang.Exception
Specified by:
checkClientResponse in class AuthAlgorithmCommand
Throws:
java.lang.Exception

execute

public Pop3CommandState execute(AbstractPop3Handler handler,
                                AbstractPop3Connection conn,
                                java.lang.String cmd,
                                Pop3CommandState state)
Description copied from class: MultiStatePop3Command
Executes the command. If the state returned is different from Pop3CommandState.COMPLETED_STATE or Pop3CommandState.ERROR_STATE, it means that execution of the command needs some additional request/response steps to complete its execution.

Overrides:
execute in class AuthAlgorithmCommand
Parameters:
handler - a pop3 handler
conn - a pop3 connection
cmd - the command line sent by the client
state - the state of the command execution, if null it's considered to be in the initial state.
Returns:
a Pop3CommandState as the next state of the command