Clover Coverage Report
Coverage timestamp: Sun Mar 23 2008 08:24:39 GMT
16   48   7   5.33
8   31   0.56   3
3     3  
1    
 
 
  DefaultRevocationChecker       Line # 11 16 7 0% 0.0
 
No Tests
 
1    package issrg.pba.rbac;
2   
3    import issrg.pba.ParsedToken;
4    import issrg.utils.ACNotFoundException;
5   
6   
7    /**
8    *
9    * @author Rune Bjerk 10.07.2007
10    */
 
11    public class DefaultRevocationChecker implements RevocationChecker {
12   
 
13  0 toggle public boolean isRevoked(ParsedToken token) throws ACNotFoundException { //return true if the attribute certificate is revoked
14  0 if(token instanceof Revocable){
15    //TODO Implement a check for valid AC's not just revoked AC's
16    //System.out.println("DefaultRevocationChecker:doesFileExist:"+issrg.utils.WebdavUtil.doesFileExist());
17  0 try{
18  0 byte[] webdavAC = issrg.utils.WebdavUtil.getRawAC(((Revocable)token).getValidationURL());
19  0 return compareACs(((Revocable)token).getOriginalAC(),webdavAC);
20    }catch(ACNotFoundException valNotFound){
21  0 try{
22  0 byte[] revokedAC = issrg.utils.WebdavUtil.getRawAC(((Revocable)token).getValidationURL());
23  0 return compareACs(((Revocable)token).getOriginalAC(),revokedAC);
24    }catch(ACNotFoundException revNotFound){
25    //Revoked AC is only checked after validation ac is not found. If revoked AC is not found then an exception should be thrown
26    //This way the caller can decide what to do with the exception
27  0 throw new ACNotFoundException("Neither validation or revocation attribute certificate were found");
28    }
29    }
30    }
31  0 return true; //If everything else fails then it should be considered revoked(should not happen)
32    }
33   
 
34  0 toggle private boolean compareACs(byte[] originalAC,byte[] newAC){
35   
36  0 if(originalAC.length!=newAC.length) return false;
37  0 for(int i=0;i<originalAC.length;i++){
38  0 if(originalAC[i]!=newAC[i]) return false;
39    }
40  0 return true;
41    }
42   
 
43  0 toggle public boolean isRevoked(Object token) throws RevocationNotDecisiveException {
44    // TODO Auto-generated method stub
45  0 return false;
46    }
47   
48    }