Clover Coverage Report
Coverage timestamp: Sun Mar 23 2008 08:24:39 GMT
10   133   1   1.43
0   38   0.7   7
7     1  
1    
 
 
  PermisSubject       Line # 54 10 1 94.1% 0.9411765
 
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;
33   
34    import java.security.Principal;
35    import java.util.Vector;
36   
37    import issrg.pba.RiskAssessment;
38    import issrg.pba.Subject;
39    import issrg.pba.Credentials;
40    import issrg.pba.CredentialsService;
41   
42    /**
43    * The Permis implementation of a subject. It knows the holder and its
44    * credentials, it contains additional service for checking the credentials
45    * validity. It knows what policy it is applicable to, and works for one
46    * PermisRBAC object only.
47    *
48    * @author A Otenko
49    * @author E Ball
50    * @author D W Chadwick
51    * @version 0.2
52    */
53   
 
54    public class PermisSubject implements Subject {
55    private Principal SubjectName;
56    private CredentialsService additionalService;
57    private Credentials Creds;
58    protected String PolicyOID;
59    protected issrg.pba.PBAAPI owner;
60   
 
61  0 toggle protected PermisSubject(){}
62   
63    /**
64    * This constructor builds a subject from a distinguished name and the
65    * credentials the holder possesses.
66    *
67    * @param owner is the reference to the PBA API implementation that has
68    * created this object; so the owner could ensure it uses the
69    * subject for the right policy
70    * @param DN the distinguished name of the subject
71    * @param service is the run-time restriction on use of the credential set
72    * contained within this Subject
73    * @param policyOID The OID of the policy controlling the subject
74    * @param creds the Credential of the subject
75    */
 
76  1349 toggle protected PermisSubject(issrg.pba.PBAAPI owner, Principal DN, CredentialsService service,
77    String PolicyOID, issrg.pba.Credentials creds){
78  1349 this.owner = owner;
79   
80  1349 SubjectName=DN;
81  1349 additionalService=service;
82  1349 this.PolicyOID = PolicyOID;
83  1349 Creds = creds;
84    }
85   
86   
87    /**
88    * This method returns the Credentials (roles for the Permis project) of the
89    * subject.
90    *
91    * @return the Credential of the subject
92    */
 
93  1456 toggle public Credentials exportCreds(){
94  1456 return Creds;
95    }
96   
97   
98    /**
99    * This method returns the distinguished name of the subject.
100    *
101    * @return the Principal, representing the name of the holder
102    */
 
103  142 toggle public Principal getHolder(){
104  142 return SubjectName;
105    }
106   
107    /**
108    * This method returns the distinguished name of the subject as a string.
109    *
110    * @return the String representation of the holder name
111    */
 
112  66 toggle public String getName(){
113  66 return getHolder().getName();
114    }
115   
116    /**
117    * This method returns the object providing additional service on the set of
118    * credentials.
119    *
120    * @return the CredentialService instance; can be null, if no additional
121    * services were attached to the credentials
122    */
 
123  1359 toggle public CredentialsService getService(){
124  1359 return additionalService;
125    }
126   
127    /**
128    * This method returns the owner of the Subject object.
129    */
 
130  1359 toggle public issrg.pba.PBAAPI getOwner(){
131  1359 return owner;
132    }
133    }