[go: up one dir, main page]

Menu

[r3]: / index.jsp  Maximize  Restore  History

Download this file

177 lines (160 with data), 5.4 kB

  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
<%@ page import="java.util.*" %>
<%@ page import="com.novell.ldap.*" %>
<%@ page import="com.novell.ldap.util.*" %>
<%@include file="config.java"%>
<%@ page errorPage="error.jsp" %>
<HTML>
<HEAD>
<SCRIPT language="javascript">
function checkForm(form)
{
if ((form.name.value == null) || (form.name.value.length == 0))
{
alert("You must specify a name!");
return false;
}
if ((form.password.value == null) || (form.password.value.length == 0))
{
alert("You must specify a password!");
return false;
}
return true;
}
</SCRIPT>
<TITLE>LDAP User Consistency Checker</TITLE>
<link rel="stylesheet" href="hf_style.css">
</HEAD>
<BODY leftmargin="0" marginwidth="0" topmargin="0" marginheight="0">
<%
// Get the current connection object
LDAPConnection connection = (LDAPConnection)session.getValue("Connection");
// If no connection is available bind anonymously
if (connection == null) {
// create a connection to the host on the specified port
try {
connection = new LDAPConnection();
connection.connect(Address, connection.DEFAULT_PORT);
}
catch (LDAPException e){
String message = e.getMessage();
throw new Exception("Application could not establish a connection to the tree, please ensure your configuration is correct " + message);
}
// Save connection object in session
session.putValue("Connection", connection);
}
// Clear any leftover session vars
if (session.getValue("who") != null)
{
session.removeValue("who");
}
if (session.getValue("pass") != null)
{
session.removeValue("pass");
}
%>
<table border="0" cellpadding="0" cellspacing="0">
<tr height="90">
<td height="90" colspan="3">
<img src="images/logo.png" border="0"></td>
</tr>
<tr>
<td bgcolor="#A5BFFF" valign="top" width="211">
<p>
<%
String userdn = connection.getAuthenticationDN();
boolean auth;
// Authenticated?
// The Java LDAP Draft 16 was updated to clarify that getAuthenticationDN
// should return null if the connection is anonymous
// as of Oct 2001, Novell JLDAP SDK is returning an empty string
if ( (userdn != "") && (userdn != null) ) {
auth = true;
// save off the DN of the user
session.putValue("userdn", userdn);
// get the CN of the user
String name = (String) session.getValue("name");
session.putValue("name", name);
%>
<div class="marginleft1">
<br>Welcome<br><SPAN CLASS="head2e"><%=name%></span><br>
<br>
<br>
<a href="unauth.jsp">Logout</a><br>
<br>
</div>
<td valign="top" width="15"></td>
<td valign="top" width="537">
<div class="head2">User Compare<br></div>
<form name="usercomp" action="examineother.jsp" method="post" >"return checkFrom(this1)">
<table border="o" cellpadding="2" cellspacing="0" bgcolor="white">
<tr>
<td class="head4">Name:</td>
<td colspan="2" valign="top" class="mediumtext">
<input type="text" size="15" name="who" value="">
</td>
</tr>
<tr>
<td valign="top" colspan="3">
<input type="submit" name="Submit" value="Search"></td></tr>
</table>
</form>
</div>
<div class="head2">Authenticate Test<br></div>
<form name="passcomp" action="passwordother.jsp" method="post" >"return checkFrom(this1)">
<table border="o" cellpadding="2" cellspacing="0" bgcolor="white">
<tr>
<td class="head4">Name:</td>
<td colspan="2" valign="top" class="mediumtext">
<input type="text" size="15" name="who" value="">
</td>
</tr>
<tr>
<td class="head4">Password:</td>
<td colspan="2" valign="top" class="mediumtext">
<input type="text" size="15" name="pass" value="">
</td>
</tr>
<tr>
<td valign="top" colspan="3">
<input type="submit" name="Submit" value="Authenticate"></td></tr>
</table>
</form>
</div>
<%
} else {
auth = false;
%>
<div class="marginleft1">
<span class="head2e">Please Login</span><br>
<br></p>
<form name="AuthUser" action="auth.jsp" method="post" >"return checkForm(this)">
<table border="0" cellpadding="2" cellspacing="0" bgcolor="white" width="170">
<tr><td valign="top" colspan="3" class="head3">Login</td></tr>
<tr height="15"><td class="head4" colspan="3" height="15"></td></tr>
<tr><td class="head4">Name:</td>
<td class="head4" colspan="2" valign="top" class="mediumtext"><input type="text" size="15" name="name" value=""></td></tr>
<tr><td valign="top" class="head4">Password:</td>
<td class="head4" valign="top" colspan="2"><input type="password"
size="15" name="password" value=""></td></tr>
<tr height="15"><td class="head4" valign="top" colspan="3" height="15"></td></tr>
<tr><td class="head4" valign="top" colspan="3">
<input type="submit" name="Submit" value="Login"></td></tr>
</table></form></div>
<%
}
%>
<p></p></td><td valign="top" width="15"></td></tr></table><p>
<%
if (debug)
{
Enumeration keys = session.getAttributeNames();
while (keys.hasMoreElements())
{
String key = (String)keys.nextElement();
out.println(key + ": " + session.getValue(key) + "<br>");
}
}
%>
</p>
</BODY>
</HTML>