Pages

Ads 468x60px

Thursday, July 26, 2012

Java: IBM Tivoli Access Manager (ITAM-eb) Default Password Validation



These are the following IBM Tivoli Access Manager (ITAM-eb)  password policy parameters and the default values:

Parameter                                 Default Value
min-password-length                         8

min-password-alphas                         4

min-password-non-alphas                 1

max-password-repeated-chars         2

password-spaces                            not set

If you are using IBM Tivoli Directory Server (ITDS) integrated with ITAM-eb, then you can see its password guidelines here:
http://pic.dhe.ibm.com/infocenter/tivihelp/v2r1/index.jsp?topic=%2Fcom.ibm.IBMDS.doc%2Fadmin_gd198.htm

This class will help you for IBM Tivoli Access Manager (ITAM-eb)  password validation and user email validation.



import java.util.regex.Matcher;
import java.util.regex.Pattern;

// for validations of password
public class Validation {

// email regular expression
private static final String EMAIL_PATTERN = "^[_A-Za-z0-9-]+(\\.[_A-Za-z0-9-]+)*@[A-Za-z0-9]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$";

// validate password length
public static boolean passwordLength(String pwd) {
boolean length = false;

if (pwd.length() >= 8) {
length = true;
}
return length;
}

// validate password's count of alpha characters
public static boolean passwordAlphaCount(String pwd) {
boolean alpha = false;
int count = 0;

try {

for (int i = 0; i < pwd.length(); i++) {
if (Character.isLetter(pwd.charAt(i)))
++count;
}

if (count >= 4)
alpha = true;
} catch (Exception ex) {

}
return alpha;
}

// validate password's count of non alpha characters
public static boolean passwordNonAlphaCount(String pwd) {
boolean nonalpha = false;
int count = 0;

try {

for (int i = 0; i < pwd.length(); i++) {
if (Character.isDigit(pwd.charAt(i)))
++count;
}

if (count >= 1)
nonalpha = true;
} catch (Exception ex) {

}
return nonalpha;
}

// validate password's repetition of characters
public static boolean passwordCharRepeat(String pwd) {
boolean repeat = true;

for (int i = 2; i < pwd.length(); i++) {

if (String.valueOf(pwd.charAt(i - 2)).equals(String.valueOf(pwd.charAt(i - 1)))
&& String.valueOf(pwd.charAt(i - 1)).equals(String.valueOf(pwd.charAt(i ))))
repeat = false;
}
return repeat;
}

// validate IBM Tivoli Access Manager user email
public static boolean emailValidate(final String email) {

Pattern pattern = Pattern.compile(EMAIL_PATTERN);
Matcher matcher = pattern.matcher(email);
return matcher.matches();
}
}


1 comment:

  1. Thank you very much for this article, it is so rare to see nowadays written as fervently article. I enjoyed reading it and I learned a lot of things. I will go and continue reading your blog =). Good luck for the future and another one for the quality of it.You can also check out this (http://www.sqiar.com).

    ReplyDelete