summaryrefslogtreecommitdiffstats
path: root/dogtag/kra-ui/shared/webapps/kra/agent/kra/processReq.template
blob: 078764d989640f46a4a711def96c0bced016b37a (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
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head> 
   <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>  
<CMS_TEMPLATE>
<SCRIPT LANGUAGE="JavaScript"></SCRIPT>
<SCRIPT LANGUAGE="JavaScript" SRC="../helpfun.js"></SCRIPT>
<SCRIPT LANGUAGE="JavaScript">
//<!--

function toHex(number)
{
    var absValue = "", sign = "";
    var digits = "0123456789abcdef";
    if (number < 0) {
        sign = "-";
        number = -number;
    }

    for(; number >= 16 ; number = Math.floor(number/16)) {
        absValue = digits.charAt(number % 16) + absValue;
    }
    absValue = digits.charAt(number % 16) + absValue;
    return sign + absValue;
}

function renderHexNumber(number,width)
{
    var num = toHex(number);
    while (num.length < width)
        num = "0"+num;
    return "0x"+num;
}

function renderDateFromSecs(secs)
{
    if (secs == null) return "";
    var today = new Date();
    var dateTmp = new Date();
    dateTmp.setTime(secs * 1000);
    var dateStr = dateTmp.toLocaleString();
    return dateStr;
}

function passwdValidate()
{

    if (document.forms[0].p12Password.value != document.forms[0].p12PasswordAgain.value) {
        alert("Passwords do not match");
        return false;
    }
    return true;
}

// 
// This form is a template that gets a preamble defining the contents
// of the request form as a JavaScript object called 'result.header'.
// whose properties are filled in by the server.
// 
document.writeln('<body vlink="0000ff" alink="ff0000" link="0000ff" bgcolor="white">');
document.writeln(
	'<font face="PrimaSans BT, Verdana, sans-serif"><font size=+1>'+
	'Request ' +
	'<a href="/kra/agent/kra/processReq?op=processReq&seqNum=' + 
	result.header.seqNum + '"' + 
	'onMouseOver=" return helpstatus(\'Click to redisplay this ' +
	'request \')" onMouseOut="return helpstatus(\'\')">' +
	result.header.seqNum + 
	'</a></font></font>');
document.writeln('<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH="100%" BACKGROUND="/pki/images/hr.gif"><TR><TD></TD></TR></TABLE>');


document.writeln('<form action="/kra/agent/kra/getAsyncPk12" method=post onSubmit="return passwdValidate()">');
document.writeln('<table border="0" cellspacing="2" cellpadding="2" width="100%">');
document.writeln('<tr><td valign="top" align="left" colspan="3" bgcolor="#e5e5e5">');
document.writeln('<font size="-1" face="PrimaSans BT, Verdana, sans-serif">'
);
document.writeln('Request</font></td></tr>');
document.writeln('<tr>');
document.write('<td align=right><font size="-1" face="PrimaSans BT, Verdana, sans-serif">Status:</font></td>');
document.write('<td align=left><font size="-1" face="PrimaSans BT, Verdana, sans-serif">' + result.header.status + '</font></td>');
document.writeln('</tr>');

// Note these values are filtered for safety by the server.
if (result.header.requestorName != null ||
    result.header.requestorEmail != null ||
    result.header.requestorPhone != null) {
     document.writeln('<p><b> Requestor\'s Contact Information:</b><br>');
     document.writeln('<blockquote>');
     if (result.header.requestorName != null) {
        document.writeln('<b> Name: </b>',
			 result.header.requestorName,
	                 '<br>');
     }
     if (result.header.requestorEmail != null) {
        document.writeln('<b> E-mail: </b>',
			 result.header.requestorEmail,
	                 '<br>');
     }
     if (result.header.requestorPhone != null) {
        document.writeln('<b> Phone: </b>',
			 result.header.requestorPhone,
	                 '<br>');
     }
     document.writeln('</blockquote>');
}

// request type
document.writeln('<tr>');
document.write('<td align=right><font size="-1" face="PrimaSans BT, Verdana, sans-serif">Type:</font></td>');
document.write('<td align=left><font size="-1" face="PrimaSans BT, Verdana, sans-serif">' + result.header.requestType + '</font></td>');
document.writeln('</tr>');

// createdOn
document.writeln('<tr>');
document.write('<td align=right><font size="-1" face="PrimaSans BT, Verdana, sans-serif">Created on:</font></td>');
document.write('<td align=left><font size="-1" face="PrimaSans BT, Verdana, sans-serif">' + renderDateFromSecs(result.header.createdOn) + '</font></td>');
document.writeln('</tr>');

// updateBy
document.writeln('<tr>');
document.write('<td align=right><font size="-1" face="PrimaSans BT, Verdana, sans-serif">Updated by:</font></td>');
document.write('<td align=left><font size="-1" face="PrimaSans BT, Verdana, sans-serif">' + result.header.updatedBy + '</font></td>');
document.writeln('</tr>');

// updatedOn
document.writeln('<tr>');
document.write('<td align=right><font size="-1" face="PrimaSans BT, Verdana, sans-serif">Updated on:</font></td>');
document.write('<td align=left><font size="-1" face="PrimaSans BT, Verdana, sans-serif">' + renderDateFromSecs(result.header.updatedOn) + '</font></td>');
document.writeln('</tr>');

document.writeln('<INPUT TYPE="HIDDEN" NAME="seqNum" VALUE="' +
                 result.header.seqNum + '">');

if (result.header.requestorName != null) {
	document.writeln('<INPUT TYPE="HIDDEN" NAME="requestorName" VALUE="' +
			result.header.requestorName + '">');
}
if (result.header.requestorEmail != null) {
	document.writeln('<INPUT TYPE="HIDDEN" NAME="requestorEmail" VALUE="' +
			result.header.requestorEmail + '">');
}
if (result.header.requestorPhone != null) {
	document.writeln('<INPUT TYPE="HIDDEN" NAME="requestorPhone" VALUE="' +
			result.header.requestorPhone + '">');
}


// Note: requestorComments are safely filtered by server
if (result.header.requestorComments != null) {
	document.writeln('<b> Comments Made When The Request Was Filed:</b><br>');
	document.writeln('<blockquote>', result.header.requestorComments,
		     '</blockquote>');
	document.writeln('<b> Additional Comments:</b><br>');
	document.writeln('<blockquote>');
	document.writeln('<INPUT TYPE="TEXT" NAME="moreComments" SIZE=72 VALUE="">');
	document.writeln('</blockquote>');
}

if (result.header.requestType == "enrollment") {
        document.writeln('<tr><td valign="top" align="left" colspan="3" bgcolor="#e5e5e5">');
        document.writeln('<font size="-1" face="PrimaSans BT, Verdana, sans-serif">');
        document.writeln('Archival Information</font></td></tr>');

	// Archival-specific UI
	document.writeln('<tr>');
	document.write('<td align=right><font size="-1" face="PrimaSans BT, Verdana, sans-serif">Public key:</font></td>');
	document.write('<td align=left><font size="-1" face="PrimaSans BT, Verdana, sans-serif">' + result.header.publicKey + '</font></td>');
	document.writeln('</tr>');

	document.writeln('<tr>');
	document.write('<td align=right><font size="-1" face="PrimaSans BT, Verdana, sans-serif">Owner name:</font></td>');
	document.write('<td align=left><font size="-1" face="PrimaSans BT, Verdana, sans-serif">' + result.header.ownerName + '</font></td>');
	document.writeln('</tr>');

	// key serial number
	document.writeln('<tr>');
	document.write('<td align=right><font size="-1" face="PrimaSans BT, Verdana, sans-serif">Key identifier:</font></td>');
	document.write('<td align=left><font size="-1" face="PrimaSans BT, Verdana, sans-serif">' + result.header.serialNumber + '</font></td>');
	document.writeln('</tr>');

} else if (result.header.requestType == "recovery") {
        document.writeln('<tr><td valign="top" align="left" colspan="3" bgcolor="#e5e5e5">');
        document.writeln('<font size="-1" face="PrimaSans BT, Verdana, sans-serif">');
        document.writeln('Recovery Information</font></td></tr>');

	// Recovery-specific UI
	// key serial number
	document.writeln('<tr>');
	document.write('<td align=right><font size="-1" face="PrimaSans BT, Verdana, sans-serif">Key identifier:</font></td>');
	document.write('<td align=left><font size="-1" face="PrimaSans BT, Verdana, sans-serif">' + result.header.serialNumber + '</font></td>');
	document.writeln('</tr>');

	// Recovery agents who have approved the recovery request
        var initAgent="";
        var approveAgents="";
        if (result.header.approvingAgents.indexOf(",")== -1) {
            initAgent = result.header.approvingAgents;
        } else {
            initAgent = result.header.approvingAgents.substring(0,
                result.header.approvingAgents.indexOf(","));
            approveAgents = result.header.approvingAgents.substring(
                      result.header.approvingAgents.indexOf(",")+1);
        }
	document.writeln('<tr>');
	document.write('<td align=right><font size="-1" face="PrimaSans BT, Verdana, sans-serif">Recovery Initiating Agent:</font></td>');
	document.write('<td align=left><font size="-1" face="PrimaSans BT, Verdana, sans-serif">' + initAgent+ '</font></td>');
	document.writeln('</tr>');
	document.writeln('<tr>');
	document.write('<td align=right><font size="-1" face="PrimaSans BT, Verdana, sans-serif">Recovery Approving Agents:</font></td>');
	document.write('<td align=left><font size="-1" face="PrimaSans BT, Verdana, sans-serif">' + approveAgents
                 + '</font></td>');
	document.writeln('</tr>');
}


if (result.header.status != "complete") {
        document.writeln('<tr><td valign="top" align="left" colspan="3" bgcolor="#e5e5e5">');
        document.writeln('<font size="-1" face="PrimaSans BT, Verdana, sans-serif">');
        document.writeln('Action</font></td></tr>');
    if (result.header.requestType == "recovery") {
      if (result.header.status == "pending") {
document.writeln('<tr>');
document.write('<td align=right><font size="-1" face="PrimaSans BT, Verdana, sans-serif">Asynchronous Key Recovery:</font></td>');
        document.writeln('<td align=left><font size="-1" face="PrimaSans BT, Verdana, sans-serif"><a href="/kra/agent/kra/grantAsyncRecovery?op=grantRecovery&reqID=' +
            result.header.seqNum + '">' + ' Grant</a></font></td>');
document.writeln('</tr>');

      } else if (result.header.status == "approved") {
        var initAgent = result.header.approvingAgents.substring(0,
             result.header.approvingAgents.indexOf(","));

        // get PKCS#12 password
        document.writeln('<tr>');
        document.write('<td align=right><font size="-1" face="PrimaSans BT, Verdana, sans-serif">PKCS #12 Password:</font></td>');
        document.write('<td align=left><font size="-1" face="PrimaSans BT, Verdana, sans-serif"><input type=password name="p12Password" value="" AutoComplete=off ></font></td>');
        document.writeln('</tr>');

        document.writeln('<tr>');
        document.write('<td align=right><font size="-1" face="PrimaSans BT, Verdana, sans-serif">PKCS #12 Password again:</font></td>');
        document.write('<td align=left><font size="-1" face="PrimaSans BT, Verdana, sans-serif"><input type=password name="p12PasswordAgain" value="" AutoComplete=off ></font></td>');
        document.writeln('</tr>');

        document.writeln('<tr>');
        document.writeln('<input type=hidden name="op" VALUE="getAsyncPk12">');
        document.writeln('<input type=hidden name="reqID" VALUE="' +
                result.header.seqNum + '">\n');
        document.writeln('<td align=right><font size="-1" face="PrimaSans BT, Verdana, sans-serif">(only allowed for initiating agent,' + initAgent+')</font></td>');
        document.writeln('<td align=left><font size="-1" face="PrimaSans BT, Verdana, sans-serif"><input type=submit value="Retrieve PKCS#12"></font></td>');
        document.writeln('</tr>');
      }
    } else {
	if (result.header.assignedTo != null) {
	   document.write('<b> Assigned To: </b>',result.header.assignedTo);
	} else {
	   document.write('<b> Unassigned </b>');
	}
	if (result.header.assignedTo == null) {
	  document.write('<a href="/kra/agent/kra/processReq?op=processReq&doAssign=yes&seqNum=' +
                     result.header.seqNum + '"' + 
                     'onMouseOver=" return helpstatus(\'Click to assign the ' +
                     'request to yourself\')" ' +
                     'onMouseOut="return helpstatus(\'\')">', 
                     ' Assign To Me','</a>');
	} else if (result.header.assignedTo != result.header.callerName) {
		document.write('<a href="/' +
                     '/kra/agent/kra/processReq?op=processReq&doAssign=yes&overrideAssignment=yes&seqNum=' + result.header.seqNum + '">',
                 ' Re-assign To Me', '</a>');
	}    
    }
}

document.writeln('</table>');
document.writeln('</form>');
document.writeln('</body>');

//-->
</SCRIPT>

</HTML>