summaryrefslogtreecommitdiffstats
path: root/base/common/src/com/netscape/certsrv/authentication/IAuthToken.java
blob: 3c03cc1f5e85a92237067fde98e20d9f13a0b947 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
// --- BEGIN COPYRIGHT BLOCK ---
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; version 2 of the License.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this program; if not, write to the Free Software Foundation, Inc.,
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
//
// (C) 2007 Red Hat, Inc.
// All rights reserved.
// --- END COPYRIGHT BLOCK ---
package com.netscape.certsrv.authentication;

import java.io.IOException;
import java.math.BigInteger;
import java.security.cert.CertificateException;
import java.util.Date;
import java.util.Enumeration;

import netscape.security.x509.CertificateExtensions;
import netscape.security.x509.X509CertImpl;

import com.netscape.certsrv.base.EBaseException;
import com.netscape.certsrv.usrgrp.Certificates;

/**
 * AuthToken interface.
 */
public interface IAuthToken {

    /**
     * Constant for userid.
     */
    public static final String USER_ID = "userid";

    /**
     * Sets an attribute value within this AttrSet.
     *
     * @param name the name of the attribute
     * @param value the attribute object.
     * @return false on an error
     */
    public boolean set(String name, String value);

    /**
     * Gets an attribute value.
     *
     * @param name the name of the attribute to return.
     * @exception EBaseException on attribute handling errors.
     * @return the attribute value
     */
    public Object get(String name);

    /**
     * Gets an attribute value.
     *
     * @param name the name of the attribute to return.
     * @exception EBaseException on attribute handling errors.
     * @return the attribute value
     */
    public String getInString(String name);

    /**
     * Returns an enumeration of the names of the attributes existing within
     * this AttrSet.
     *
     * @return an enumeration of the attribute names.
     */
    public Enumeration<String> getElements();

    /************
     * Helpers for non-string sets and gets.
     * These are needed because AuthToken is stored in IRequest (which can
     * only store string values
     */

    /**
     * Retrieves the byte array value for name. The value should have been
     * previously stored as a byte array (it will be CMS.AtoB decoded).
     *
     * @param name The attribute name.
     * @return The byte array or null on error.
     */
    public byte[] getInByteArray(String name);

    /**
     * Stores the byte array with the associated key.
     *
     * @param name The attribute name.
     * @param value The value to store
     * @return false on an error
     */
    public boolean set(String name, byte[] value);

    /**
     * Retrieves the Integer value for name.
     *
     * @param name The attribute name.
     * @return The Integer or null on error.
     */
    public Integer getInInteger(String name);

    /**
     * Stores the Integer with the associated key.
     *
     * @param name The attribute name.
     * @param value The value to store
     * @return false on an error
     */
    public boolean set(String name, Integer value);

    /**
     * Retrieves the BigInteger array value for name.
     *
     * @param name The attribute name.
     * @return The value or null on error.
     */
    public BigInteger[] getInBigIntegerArray(String name);

    /**
     * Stores the BigInteger array with the associated key.
     *
     * @param name The attribute name.
     * @param value The value to store
     * @return false on an error
     */
    public boolean set(String name, BigInteger[] value);

    /**
     * Retrieves the Date value for name.
     *
     * @param name The attribute name.
     * @return The value or null on error.
     */
    public Date getInDate(String name);

    /**
     * Stores the Date with the associated key.
     *
     * @param name The attribute name.
     * @param value The value to store
     * @return false on an error
     */
    public boolean set(String name, Date value);

    /**
     * Retrieves the String array value for name.
     *
     * @param name The attribute name.
     * @return The value or null on error.
     */
    public String[] getInStringArray(String name);

    /**
     * Stores the String array with the associated key.
     *
     * @param name The attribute name.
     * @param value The value to store
     * @return False on error.
     */
    public boolean set(String name, String[] value);

    /**
     * Retrieves the X509CertImpl value for name.
     *
     * @param name The attribute name.
     * @return The value or null on error.
     */
    public X509CertImpl getInCert(String name);

    /**
     * Stores the X509CertImpl with the associated key.
     *
     * @param name The attribute name.
     * @param value The value to store
     * @return false on error
     */
    public boolean set(String name, X509CertImpl value);

    /**
     * Retrieves the CertificateExtensions value for name.
     *
     * @param name The attribute name.
     * @return The value.
     * @throws IOException
     */
    public CertificateExtensions getInCertExts(String name) throws IOException;

    /**
     * Stores the CertificateExtensions with the associated key.
     *
     * @param name The attribute name.
     * @param value The value to store
     * @return false on error
     */
    public boolean set(String name, CertificateExtensions value);

    /**
     * Retrieves the Certificates value for name.
     *
     * @param name The attribute name.
     * @return The value.
     * @throws IOException
     * @throws CertificateException
     */
    public Certificates getInCertificates(String name) throws IOException, CertificateException;

    /**
     * Stores the Certificates with the associated key.
     *
     * @param name The attribute name.
     * @param value The value to store
     * @return false on error
     */
    public boolean set(String name, Certificates value);

    /**
     * Retrieves the byte[][] value for name.
     *
     * @param name The attribute name.
     * @return The value.
     * @throws IOException
     */
    public byte[][] getInByteArrayArray(String name) throws IOException;

    /**
     * Stores the byte[][] with the associated key.
     *
     * @param name The attribute name.
     * @param value The value to store
     * @return false on error
     */
    public boolean set(String name, byte[][] value);
}