caAdminSession.verifyExistenceOfCA(caid);
ar = new GenerateTokenApprovalRequest(userData.getUsername(), userData.getDN(), hardTokenData.getHardToken().getLabel(),admin,null,WebServiceConfiguration.getNumberOfRequiredApprovals(),caid,userData.getEndEntityProfileId());
int status = ApprovalDataVO.STATUS_REJECTED;
try{
if(!WebServiceConfiguration.getApprovalForGenTokenCertificates()){
throw new ApprovalException("");
}
status = approvalSession.isApproved(admin, ar.generateApprovalId(), 0);
isApprovedStep0 = status == ApprovalDataVO.STATUS_APPROVED;
if( status == ApprovalDataVO.STATUS_EXPIREDANDNOTIFIED
|| status == ApprovalDataVO.STATUS_EXPIRED
|| status == ApprovalDataVO.STATUS_REJECTED){
throw new ApprovalException("");
}
}catch(ApprovalException e2){
// GenTokenCertificates approval doesn't exists, try a getHardTokenData request
if(!WebServiceConfiguration.getApprovalForHardTokenData()){
throw new AuthorizationDeniedException("JaxWS isn't configured for getHardTokenData approvals.");
}
ar = new ViewHardTokenDataApprovalRequest(userData.getUsername(), userData.getDN(), hardTokenSN, true,admin,null,WebServiceConfiguration.getNumberOfRequiredApprovals(),userData.getCAId(),userData.getEndEntityProfileId());
try{
status = approvalSession.isApproved(admin, ar.generateApprovalId());
isApprovedStep0 = status == ApprovalDataVO.STATUS_APPROVED;
isRejectedStep0 = status == ApprovalDataVO.STATUS_REJECTED;
if( status == ApprovalDataVO.STATUS_EXPIREDANDNOTIFIED
|| status == ApprovalDataVO.STATUS_EXPIRED){
throw new ApprovalException("");
}
}catch(ApprovalException e3){
genNewRequest = true;
}catch(ApprovalRequestExpiredException e3){
genNewRequest = true;