public int process(Callback[] callbacks,int state) throws AuthLoginException {
  initAuthConfig();
  X509Certificate[] allCerts=null;
  try {
    HttpServletRequest servletRequest=getHttpServletRequest();
    if (servletRequest != null) {
      allCerts=(X509Certificate[])servletRequest.getAttribute("javax.servlet.request.X509Certificate");
      if (allCerts == null || allCerts.length == 0) {
        debug.message("Certificate: checking for cert passed in the URL.");
        if (!portal_gw_cert_auth_enabled) {
          debug.error("Certificate: cert passed " + "in URL not enabled for this client");
          throw new AuthLoginException(amAuthCert,"noURLCertAuth",null);
        }
        thecert=getPortalStyleCert(servletRequest);
        allCerts=new X509Certificate[]{thecert};
      }
 else {
        if (portal_gw_cert_auth_enabled && portal_gw_cert_preferred) {
          thecert=getPortalStyleCert(servletRequest);
          allCerts=new X509Certificate[]{thecert};
        }
 else {
          if (debug.messageEnabled()) {
            debug.message("Certificate: got all certs from " + "HttpServletRequest = {}",allCerts.length);
          }
          thecert=allCerts[0];
        }
      }
    }
 else {
      thecert=sendCallback();
    }
    if (thecert == null) {
      debug.message("Certificate: no cert passed in.");
      throw new AuthLoginException(amAuthCert,"noCert",null);
    }
    getTokenFromCert(thecert);
    storeUsernamePasswd(userTokenId,null);
    if (debug.messageEnabled()) {
      debug.message("in Certificate. userTokenId=" + userTokenId + " from getTokenFromCert");
    }
  }
 catch (  AuthLoginException e) {
    setFailureID(userTokenId);
    debug.error("Certificate:  exiting validate with exception",e);
    throw new AuthLoginException(amAuthCert,"noCert",null);
  }
  if (debug.messageEnabled()) {
    debug.message("Got client cert =\n" + thecert.toString());
  }
  if (amAuthCert_chkCertInLDAP.equalsIgnoreCase("false") && amAuthCert_chkCRL.equalsIgnoreCase("false") && !ocspEnabled) {
    return ISAuthConstants.LOGIN_SUCCEED;
  }
  if (ldapParam == null) {
    setLdapStoreParam();
  }
  if (amAuthCert_chkCertInLDAP.equalsIgnoreCase("true")) {
    X509Certificate ldapcert=AMCertStore.getRegisteredCertificate(ldapParam,thecert,amAuthCert_chkAttrCertInLDAP);
    if (ldapcert == null) {
      debug.error("X509Certificate: getRegCertificate is null");
      setFailureID(userTokenId);
      throw new AuthLoginException(amAuthCert,"CertNoReg",null);
    }
  }
  int ret=doJCERevocationValidation(allCerts);
  if (ret != ISAuthConstants.LOGIN_SUCCEED) {
    debug.error("X509Certificate:CRL / OCSP verify failed.");
    setFailureID(userTokenId);
    throw new AuthLoginException(amAuthCert,"CertVerifyFailed",null);
  }
  return ISAuthConstants.LOGIN_SUCCEED;
}

public int process ( Callback [ ] callbacks , int state ) throws AuthLoginException { initAuthConfig ( ) ; X509Certificate [ ] allCerts = null ; try { HttpServletRequest servletRequest = getHttpServletRequest ( ) ; if ( servletRequest != null ) { allCerts = ( X509Certificate [ ] ) servletRequest . getAttribute ( "javax.servlet.request.X509Certificate" ) ; if ( allCerts == null || allCerts . length == 0 ) { debug . message ( "Certificate: checking for cert passed in the URL." ) ; if ( ! portal_gw_cert_auth_enabled ) { debug . error ( "Certificate: cert passed " + "in URL not enabled for this client" ) ; throw new AuthLoginException ( amAuthCert , "noURLCertAuth" , null ) ; } thecert = getPortalStyleCert ( servletRequest ) ; allCerts = new X509Certificate [ ] { thecert } ; } else { if ( portal_gw_cert_auth_enabled && portal_gw_cert_preferred ) { thecert = getPortalStyleCert ( servletRequest ) ; allCerts = new X509Certificate [ ] { thecert } ; } else { if ( debug . messageEnabled ( ) ) { debug . message ( "Certificate: got all certs from " + "HttpServletRequest = {}" , allCerts . length ) ; } thecert = allCerts [ 0 ] ; } } } else { thecert = sendCallback ( ) ; } if ( thecert == null ) { debug . message ( "Certificate: no cert passed in." ) ; throw new AuthLoginException ( amAuthCert , "noCert" , null ) ; } getTokenFromCert ( thecert ) ; storeUsernamePasswd ( userTokenId , null ) ; if ( debug . messageEnabled ( ) ) { debug . message ( "in Certificate. userTokenId=" + userTokenId + " from getTokenFromCert" ) ; } } catch ( AuthLoginException e ) { setFailureID ( userTokenId ) ; debug . error ( "Certificate:  exiting validate with exception" , e ) ; throw new AuthLoginException ( amAuthCert , "noCert" , null ) ; } if ( debug . messageEnabled ( ) ) { debug . message ( "Got client cert =\n" + thecert . toString ( ) ) ; } if ( amAuthCert_chkCertInLDAP . equalsIgnoreCase ( "false" ) && amAuthCert_chkCRL . equalsIgnoreCase ( "false" ) && ! ocspEnabled ) { return ISAuthConstants . LOGIN_SUCCEED ; } if ( ldapParam == null ) { setLdapStoreParam ( ) ; } if ( amAuthCert_chkCertInLDAP . equalsIgnoreCase ( "true" ) ) { X509Certificate ldapcert = AMCertStore . getRegisteredCertificate ( ldapParam , thecert , amAuthCert_chkAttrCertInLDAP ) ; if ( ldapcert == null ) { debug . error ( "X509Certificate: getRegCertificate is null" ) ; setFailureID ( userTokenId ) ; throw new AuthLoginException ( amAuthCert , "CertNoReg" , null ) ; } } int ret = doJCERevocationValidation ( allCerts ) ; if ( ret != ISAuthConstants . LOGIN_SUCCEED ) { debug . error ( "X509Certificate:CRL / OCSP verify failed." ) ; setFailureID ( userTokenId ) ; throw new AuthLoginException ( amAuthCert , "CertVerifyFailed" , null ) ; } return ISAuthConstants . LOGIN_SUCCEED ; }
process certificate based auth request
