home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.rsa.com
/
2014.05.ftp.rsa.com.tar
/
ftp.rsa.com
/
pub
/
partner_engineering
/
ClearTrust
/
Verity
/
ticket.jnc
< prev
next >
Wrap
Text File
|
2014-05-02
|
3KB
|
88 lines
<%
String serverSpec = null;
if (serverSpec == null || serverSpec.equals("")){
serverSpec = (String)System.getProperty("VERITY_K2_HOSTPORT");
// <Bruce Bordelon>
// also check the context configuration for the VERITY_K2_HOSTPORT property
if (serverSpec == null || serverSpec.equals("")) {
serverSpec = (String)getServletConfig().getServletContext().getInitParameter("VERITY_K2_HOSTPORT");
// </Bruce Bordelon>
}
if (serverSpec == null){
%>
<i><FONT color="red"><b>Error: Failed to obtain serverspec.</i></b></head>
<body><FONT color="red"><br>Unable to determine the serverSpec from the
environment variable VERITY_K2_HOSTPORT.<br> Please set this env variable
to point to the proper K2 Broker/Server serverspec.
</body>
</html>
<%
return;
}
String errorStr = null;
String username, passwd, domain, ticket;
HttpSession sess = request.getSession(true);
String logout = null;
{
try {
VSearch s0 = new VSearch();
s0.setServerSpec(serverSpec);
String userParam=null;
String ct_user = request.getHeader("HTTP_CT_REMOTE_USER");
s0.setK2UserName(ct_user);
userParam = "HTTP_CT_REMOTE_USER;="+ct_user;
s0.addUserParamCredential(userParam);
sess.putValue("user",ct_user);
// I18N code: Set the charmap for the VSearch object. This will cause VDK
// to input and output data in this charset.
s0.setCharMap("1252");
ticket = s0.k2Login();
// Put the ticket as session variable
sess.setAttribute("ticket", ticket);
sess.setAttribute("user",ct_user);
response.addCookie(new Cookie("SAMPLE_TEMPLATES_LOGGEDON","LoggedOn")); // set the ticket cookie
// successfully obtained the ticket. so close the window
} catch (Exception e){
String errString = e.toString();
System.out.println("Got an exception" + errString);
if ((errString.indexOf("connection refused") >= 0) ||
(errString.indexOf("Connection refused") >= 0) ||
(errString.indexOf("Connection Refused") >= 0)) {
errorStr = "<b>Login error: unable to connect to K2Server/Broker.</b>";
} else if (errString.indexOf("-303") >= 0) {
errorStr = "<b>Incorrect username and password</b>";
} else if (errString.indexOf("-304") >= 0) {
errorStr = "<b>Login error: No user credentials available (-304)<b>";
} else if (errString.indexOf("-305") >= 0) {
errorStr = "<b> Login error: call to K2Ticket failed (-305)<b>";
} else if (errString.indexOf("-306") >= 0) {
errorStr = "<b>Login error: K2Ticket server is not available (-306)<b>";
} else if (errString.indexOf("-1012") >= 0) {
errorStr = "<b>Login error: -1012</b>";
} else if (errString.indexOf("-314") >= 0) {
errorStr = "<b>Ticket error: ticket has expired (-314)<b>";
} else if (errString.indexOf("-80") >= 0) {
errorStr = "<b>Ticket error: ticket is invalid (-80)<b>";
} else if (errString.indexOf("-14") >= 0) {
errorStr = "<b>Ticket error: ticket is null (-14)<b>";
} else {
errorStr = errString ;
}
}
}
%>