protected int checkIPHistory(){
  int retVal=0;
  String ipHistoryValues=null;
  String newHistory=clientIP;
  int historyCount=0;
  if (IPHistoryAttribute != null) {
    ipHistoryValues=getIdentityAttributeString(IPHistoryAttribute);
    if (debug.messageEnabled()) {
      debug.message("{}.checkIPHistory: Client IP = {}, History IP = {}",ADAPTIVE,clientIP,ipHistoryValues);
    }
    if (ipHistoryValues != null) {
      StringTokenizer st=new StringTokenizer(ipHistoryValues,"|");
      while (st.hasMoreTokens()) {
        String theIP=st.nextToken();
        historyCount+=1;
        if (historyCount < IPHistoryCount) {
          newHistory+="|" + theIP;
        }
        if (clientIP.equals(theIP)) {
          retVal=IPHistoryScore;
        }
      }
    }
  }
  if (IPHistorySave && retVal == 0) {
    postAuthNMap.put("IPSAVE",newHistory);
    postAuthNMap.put("IPAttr",IPHistoryAttribute);
  }
  if (!IPHistoryInvert) {
    retVal=IPHistoryScore - retVal;
  }
  return retVal;
}

protected int checkIPHistory ( ) { int retVal = 0 ; String ipHistoryValues = null ; String newHistory = clientIP ; int historyCount = 0 ; if ( IPHistoryAttribute != null ) { ipHistoryValues = getIdentityAttributeString ( IPHistoryAttribute ) ; if ( debug . messageEnabled ( ) ) { debug . message ( "{}.checkIPHistory: Client IP = {}, History IP = {}" , ADAPTIVE , clientIP , ipHistoryValues ) ; } if ( ipHistoryValues != null ) { StringTokenizer st = new StringTokenizer ( ipHistoryValues , "|" ) ; while ( st . hasMoreTokens ( ) ) { String theIP = st . nextToken ( ) ; historyCount += 1 ; if ( historyCount < IPHistoryCount ) { newHistory += "|" + theIP ; } if ( clientIP . equals ( theIP ) ) { retVal = IPHistoryScore ; } } } } if ( IPHistorySave && retVal == 0 ) { postAuthNMap . put ( "IPSAVE" , newHistory ) ; postAuthNMap . put ( "IPAttr" , IPHistoryAttribute ) ; } if ( ! IPHistoryInvert ) { retVal = IPHistoryScore - retVal ; } return retVal ; }
check to see if the ip address being used is in the clients history iphistory is stored in a single attribute , separated by " | " if the client ip is new , ( not seen before ) then add it to front of list , and drop from end of list . the postauthn method will update the profile if needed .
