com.openexchange.admin.tools
Class GenericChecks

java.lang.Object
  extended by com.openexchange.admin.tools.GenericChecks

public class GenericChecks
extends Object

Author:
choeger

Constructor Summary
GenericChecks()
           
 
Method Summary
static boolean authByMech(String crypted, String clear, String mech)
          Authenticate the cleartext password against the crypted string using the specified authmech
static void checkChangeValidPasswordMech(PasswordMechObject user)
          Checks whether supplied password mech is a valid password mech as specified in PasswordMechObject.
static void checkCreateValidPasswordMech(PasswordMechObject user)
          Checks whether supplied password mech is a valid password mech as specified in PasswordMechObject.
static void checkValidMailAddress(String address)
          This method throws an exception if the address is != null and contains invalid characters
static boolean isValidMailAddress(String address)
          This method checks if an address contains invalid characters
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GenericChecks

public GenericChecks()
Method Detail

isValidMailAddress

public static final boolean isValidMailAddress(String address)
This method checks if an address contains invalid characters

Parameters:
address - The address string to check

checkValidMailAddress

public static final void checkValidMailAddress(String address)
                                        throws InvalidDataException
This method throws an exception if the address is != null and contains invalid characters

Parameters:
address - The address string to check
Throws:
InvalidDataException - If given address string is not a valid email address

checkChangeValidPasswordMech

public static final void checkChangeValidPasswordMech(PasswordMechObject user)
                                               throws InvalidDataException
Checks whether supplied password mech is a valid password mech as specified in PasswordMechObject. Checks whether password is not an empty string. Checks checks whether mech has changed without supplying new password string

Parameters:
user -
Throws:
InvalidDataException

checkCreateValidPasswordMech

public static final void checkCreateValidPasswordMech(PasswordMechObject user)
                                               throws InvalidDataException
Checks whether supplied password mech is a valid password mech as specified in PasswordMechObject.

Parameters:
user -
Throws:
InvalidDataException

authByMech

public static final boolean authByMech(String crypted,
                                       String clear,
                                       String mech)
                                throws NoSuchAlgorithmException,
                                       UnsupportedEncodingException
Authenticate the cleartext password against the crypted string using the specified authmech

Parameters:
crypted -
clear -
mech -
Returns:
true if authentication succeeds and false if it fails
Throws:
NoSuchAlgorithmException
UnsupportedEncodingException