Clover Coverage Report
Coverage timestamp: Sun Mar 23 2008 08:24:39 GMT
17   122   8   4.25
10   38   0.65   4
4     2.75  
1    
 
 
  IssuerEntry       Line # 49 17 8 0% 0.0
 
No Tests
 
1    /*
2    * Copyright (c) 2000-2005, University of Salford
3    * All rights reserved.
4    *
5    * Redistribution and use in source and binary forms, with or without
6    * modification, are permitted provided that the following conditions are met:
7    *
8    * Redistributions of source code must retain the above copyright notice, this
9    * list of conditions and the following disclaimer.
10    *
11    * Redistributions in binary form must reproduce the above copyright notice,
12    * this list of conditions and the following disclaimer in the documentation
13    * and/or other materials provided with the distribution.
14    *
15    * Neither the name of the University of Salford nor the names of its
16    * contributors may be used to endorse or promote products derived from this
17    * software without specific prior written permission.
18    *
19    * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20    * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21    * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22    * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
23    * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24    * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25    * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26    * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27    * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28    * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29    * POSSIBILITY OF SUCH DAMAGE.
30    */
31   
32    package issrg.pba.rbac.x509;
33   
34    import issrg.pba.repository.*;
35   
36    import issrg.pba.rbac.LDAPDNPrincipal;
37    /**
38    * This class represents the entry of the issuer of the authorisation token. It
39    * is used in the delegation policy when deciding what credentials the issuer
40    * has got.
41    *
42    * <p>It is aware of the authorisation token format, so it knows where to find
43    * the issuer information.
44    *
45    * @author A Otenko
46    * @version 1.0
47    */
48   
 
49    public class IssuerEntry extends UserEntry {
50   
 
51  0 toggle protected IssuerEntry(){}
52   
53    /**
54    * This constructor builds an object using the retrieved Authorisation Token.
55    * It should be the byte array of a BER-encoded X.509 Attribute Certificate.
56    *
57    * @param ac is the byte array representing the X.509 AC, of which the Issuer
58    * will be represented by this object
59    *
60    * @throws IllegalArgumentException if it is not a byte array, or is not a
61    * proper X.509 AC
62    */
 
63  0 toggle public IssuerEntry(Object ac) {
64  0 if (!(ac instanceof byte [])){
65  0 throw new IllegalArgumentException("ac object should be a byte array: byte []");
66    }
67   
68  0 try{
69  0 _init_(issrg.ac.AttributeCertificate.guessEncoding((byte[])ac));
70    }catch(iaik.asn1.CodingException ce){
71  0 throw new IllegalArgumentException("ac object should be a correct BER encoded X.509 AC: "+ce.getMessage());
72    }
73    }
74   
75    /**
76    * This constructor can build an object out of the AttributeCertificate object
77    * - a ready to use object. Note that usually the caller will need the
78    * constructor with the Object passed to it.
79    *
80    * @param ac is the AttributeCertificate of which the Issuer will be
81    * represented by this object
82    *
83    * @see IssuerEntry(Object)
84    */
 
85  0 toggle public IssuerEntry(issrg.ac.AttributeCertificate ac) {
86  0 _init_(ac);
87    }
88   
89    /**
90    * This method is used for proper initialising the object by all the
91    * constructors. It actually does the work described for the <code>
92    * IssuerEntry(AttributeCertificate ac)</code> constructor.
93    *
94    * @param ac is the AttributeCertificate object with which the IssuerEntry is
95    * initialised
96    *
97    * @see IssuerEntry(issrg.ac.AttributeCertificate)
98    */
 
99  0 toggle protected void _init_(issrg.ac.AttributeCertificate ac){
100  0 String subj = issrg.ac.Util.generalNamesToString(ac.getACInfo().getIssuer().getV1Form());
101  0 if (subj==null || subj.intern()==""){
102  0 subj = issrg.ac.Util.generalNamesToString(ac.getACInfo().getIssuer().getV2Form().getIssuerName());
103    }
104   
105  0 String issuer = null;
106  0 java.math.BigInteger serial = null;
107   
108  0 if (ac.getACInfo().getIssuer().getV2Form()!=null && ac.getACInfo().getIssuer().getV2Form().getBaseCertificateID()!=null){
109  0 serial = ac.getACInfo().getIssuer().getV2Form().getBaseCertificateID().getSerial();
110  0 issuer = issrg.ac.Util.generalNamesToString(ac.getACInfo().getIssuer().getV2Form().getBaseCertificateID().getIssuer());
111    }
112   
113  0 try{
114  0 _init_(subj==null?null:new LDAPDNPrincipal(subj),
115  0 issuer==null?null:new LDAPDNPrincipal(issuer),
116    serial);
117    }catch (issrg.utils.RFC2253ParsingException rpe){
118  0 throw new IllegalArgumentException(rpe.getMessage());
119    }
120    }
121    }
122