SimplePERMISToken | Line # 63 | 9 | 1 | 100% |
1.0
|
No Tests | |||
1 | ||
2 | /* | |
3 | * Copyright (c) 2006, University of Kent | |
4 | * All rights reserved. | |
5 | * | |
6 | * Redistribution and use in source and binary forms, with or without | |
7 | * modification, are permitted provided that the following conditions are met: | |
8 | * | |
9 | * Redistributions of source code must retain the above copyright notice, this | |
10 | * list of conditions and the following disclaimer. | |
11 | * | |
12 | * Redistributions in binary form must reproduce the above copyright notice, | |
13 | * this list of conditions and the following disclaimer in the documentation | |
14 | * and/or other materials provided with the distribution. | |
15 | * | |
16 | * 1. Neither the name of the University of Kent nor the names of its | |
17 | * contributors may be used to endorse or promote products derived from this | |
18 | * software without specific prior written permission. | |
19 | * | |
20 | * 2. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS | |
21 | * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | |
22 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
23 | * PURPOSE ARE DISCLAIMED. | |
24 | * | |
25 | * 3. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE | |
26 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
27 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
28 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
29 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
30 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
31 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
32 | * POSSIBILITY OF SUCH DAMAGE. | |
33 | * | |
34 | * 4. YOU AGREE THAT THE EXCLUSIONS IN PARAGRAPHS 2 AND 3 ABOVE ARE REASONABLE | |
35 | * IN THE CIRCUMSTANCES. IN PARTICULAR, YOU ACKNOWLEDGE (1) THAT THIS | |
36 | * SOFTWARE HAS BEEN MADE AVAILABLE TO YOU FREE OF CHARGE, (2) THAT THIS | |
37 | * SOFTWARE IS NOT "PRODUCT" QUALITY, BUT HAS BEEN PRODUCED BY A RESEARCH | |
38 | * GROUP WHO DESIRE TO MAKE THIS SOFTWARE FREELY AVAILABLE TO PEOPLE WHO WISH | |
39 | * TO USE IT, AND (3) THAT BECAUSE THIS SOFTWARE IS NOT OF "PRODUCT" QUALITY | |
40 | * IT IS INEVITABLE THAT THERE WILL BE BUGS AND ERRORS, AND POSSIBLY MORE | |
41 | * SERIOUS FAULTS, IN THIS SOFTWARE. | |
42 | * | |
43 | * 5. This license is governed, except to the extent that local laws | |
44 | * necessarily apply, by the laws of England and Wales. | |
45 | * | |
46 | * Author : Gansen Zhao <gz7@kent.ac.uk> and Romain Laborde <rl59@kent.ac.uk> | |
47 | * | |
48 | */ | |
49 | ||
50 | ||
51 | ||
52 | package issrg.simplePERMIS; | |
53 | ||
54 | import java.security.Principal; | |
55 | import issrg.pba.rbac.policies.SimpleEntry; | |
56 | import issrg.utils.repository.Entry; | |
57 | import issrg.utils.repository.TokenLocator; | |
58 | ||
59 | ||
60 | /** | |
61 | * This class represents a simple token that is most useful for tests. | |
62 | */ | |
63 | public class SimplePERMISToken { | |
64 | ||
65 | /** | |
66 | * The attribute type of the attribute | |
67 | */ | |
68 | String attributeType; | |
69 | ||
70 | /** | |
71 | * Value fo the attribute | |
72 | */ | |
73 | String attributeValue; | |
74 | ||
75 | /** | |
76 | * Issuer of the attribute | |
77 | */ | |
78 | TokenLocator issuer; | |
79 | Entry holder; | |
80 | ||
81 | ||
82 | /** | |
83 | * Constructor of the SimplePERMISToken. | |
84 | * @param holder The holder of the attribute | |
85 | * @param issuer The issuer of the attribute | |
86 | * @param type The type of the attribute | |
87 | * @param value The value of the attribute | |
88 | */ | |
89 | 625 | public SimplePERMISToken(Principal holder, Principal issuer, String type, String value) { |
90 | 625 | attributeType = type; |
91 | 625 | attributeValue = value; |
92 | 625 | this.holder = new SimpleEntry(holder); |
93 | 625 | this.issuer = new SimpleEntry(issuer); |
94 | } | |
95 | ||
96 | /** | |
97 | * Constructor of the SimplePERMISToken. | |
98 | * @param holderName The holder of the attribute | |
99 | * @param issuer The issuer of the attribute | |
100 | * @param type The type of the attribute | |
101 | * @param value The value of the attribute | |
102 | */ | |
103 | 625 | public SimplePERMISToken(String holderName, String issuer, String type, String value) { |
104 | 625 | this(new SimplePERMISPrincipal(holderName), new SimplePERMISPrincipal(issuer), type, value); |
105 | } | |
106 | ||
107 | /** | |
108 | * This method retrieves the holder entry | |
109 | * @return The scope domain. | |
110 | */ | |
111 | 1306 | public Entry getHolderEntry(){ |
112 | 1306 | return holder; |
113 | } | |
114 | ||
115 | /** | |
116 | * This method retrieves the Issuer Entry. | |
117 | * @return The Issuer Entry. | |
118 | */ | |
119 | 668 | public TokenLocator getIssuerTokenLocator(){ |
120 | 668 | return issuer; |
121 | } | |
122 | ||
123 | /** | |
124 | * This method retrieves the type of the attribute | |
125 | * @return The type of the attribute | |
126 | */ | |
127 | 668 | public String getAttributeType(){ |
128 | 668 | return attributeType; |
129 | } | |
130 | ||
131 | /** | |
132 | * This method retrieves the value of the attribute | |
133 | * @return The value of the attribute. | |
134 | */ | |
135 | 668 | public String getAttributeValue(){ |
136 | 668 | return attributeValue; |
137 | } | |
138 | } |
|