if(admin.getAdminInformation().getX509Certificate().getSerialNumber().toString(16).equals(approval.getAdminCertSerialNumber()) && CertTools.getIssuerDN(admin.getAdminInformation().getX509Certificate()).equals(approval.getAdminCertIssuerDN())){ throw new AuthorizationDeniedException("The approval and admin certificates doesn't match."); }
    private ApprovalDataLocal isAuthorizedBeforeApproveOrReject(Admin admin, int approvalId, Approval approval) throws ApprovalException, AuthorizationDeniedException{    	ApprovalDataLocal retval = null;    	    	retval = findNonExpiredApprovalDataLocal(admin,approvalId);    	    	if(retval != null){    		if(retval.getEndentityprofileid() == ApprovalDataVO.ANY_ENDENTITYPROFILE){    			getAuthorizationSession().isAuthorized(admin,AvailableAccessRules.REGULAR_APPROVECAACTION);				    		}else{    			getAuthorizationSession().isAuthorized(admin,AvailableAccessRules.REGULAR_APPORVEENDENTITY);    			getAuthorizationSession().isAuthorized(admin,AvailableAccessRules.ENDENTITYPROFILEPREFIX + retval.getEndentityprofileid() + AvailableAccessRules.APPROVAL_RIGHTS);    		}    		if(retval.getCaid() != ApprovalDataVO.ANY_CA){    			getAuthorizationSession().isAuthorized(admin,AvailableAccessRules.CAPREFIX + retval.getCaid());    		}    		    		// Check that the admin and the approval is the same certificate    		if(admin.getAdminInformation().getX509Certificate().getSerialNumber().toString(16).equals(approval.getAdminCertSerialNumber()) &&    				CertTools.getIssuerDN(admin.getAdminInformation().getX509Certificate()).equals(approval.getAdminCertIssuerDN())){    			throw new AuthorizationDeniedException("The approval and admin certificates doesn't match.");    		}		} else {			throw new ApprovalException("Suitable approval with id : " + approvalId + " doesn't exist");		}    	return retval;    }