evo ovaj source. ovo je deo TomServlet-a. deo koji nije paste-ovan je
method koja dekriptuje passed arguments
Code:
//verifyLogin method proverava da li je sve ok.
//sfccIdDEcrypted - je username
if (verifyLogin(request, response)){//check if user is valid
String where = (String) request.getParameter("wh"); //this parameter
controls what needs to be executed
if (where.equals("gApps"))//login to Google Apps account
{
HttpSession session = request.getSession(true);
session.setAttribute("sso", "true");
session.setAttribute("ssn", sfccIdDEcrypted);
response.sendRedirect(google_url);
}
if (where.equals("gCreate")) //create Google Apps account
{
HttpSession session = request.getSession(true);
session.setAttribute("sso", "true");
session.setAttribute("ssn", sfccIdDEcrypted);
//System.out.println("it came as: " + sfccIdDEcrypted);
l_user = new LDAP_user();
String[] info = new String[5];
/**
* info[0] - first name
* info[1] - last name
* info[2] - firsname.lastname
* info[3] - prefname.lastname
* info[4] - uid from LDAP
* info[5] - sfccid
*/
info = l_user.getLdapInfo(sfccIdDEcrypted);
if(info[1]==null){
response.sendRedirect(ERROR_URL);
}
else{
if(info[3] == null){
gAcc = new CreateGoogleAcc();
gAcc.createUser(info[2], info[0], info[1], GOOGLE_USERS_PASS, "");
}
else{//use prefered name for google account
gAcc = new CreateGoogleAcc();
gAcc.createUser(info[3], info[0], info[1], GOOGLE_USERS_PASS, "");
}
if(info[3] == null){
System.out.println("***Updating Ldap***");
System.out.println("UID: " + info[4]);
System.out.println("mail: " + info[2]);
UpdateLdapEmail updMail = new UpdateLdapEmail(info[4],
info[2]);//will update LDAP email attribute
try{
String strMail = info[2] + "@my.sfcc.edu";
System.out.println("***Updating MST_SFCC_ID***");
System.out.println("MST_SFCC_ID: " + strMail);
System.out.println("MST_SFCC_ID.SSN " + info[5]);
CallMS9630I prgMS9630I = new CallMS9630I(info[5], strMail);//will
call MS9630I to update MSF_SFCC_ID
String prgOut = prgMS9630I.getEciOutput();
String returnCode = prgOut.substring(212, 215);
String returnMsg = prgOut.substring(215, 315);
if(!returnCode.equals("000")){
System.out.println("***********ERROR UPDATING
MST_SFCC_ID*************");
System.out.println("Details:");
System.out.println("tReturn Code: " + returnCode);
System.out.println("tReturn Message: " + returnMsg);
}
}catch(Exception e){
e.printStackTrace();
}
}
else{
System.out.println("***Updating Ldap***");
System.out.println("UID: " + info[4]);
System.out.println("mail: " + info[3]);
UpdateLdapEmail updMail = new UpdateLdapEmail(info[4],
info[3]);//will update LDAP email attribute
try{
String strMail = info[3] + "@my.sfcc.edu";
System.out.println("***Updating MST_SFCC_ID***");
System.out.println("MST_SFCC_ID: " + strMail);
System.out.println("MST_SFCC_ID.SSN " + info[5]);
/***ovo je ECI caalll koji update-uje DB2*//
CallMS9630I prgMS9630I = new CallMS9630I(info[5], strMail);//will
call MS9630I to update MSF_SFCC_ID
String prgOut = prgMS9630I.getEciOutput();
String returnCode = prgOut.substring(212, 215);
String returnMsg = prgOut.substring(215, 315);
if(!returnCode.equals("000")){
System.out.println("***********ERROR UPDATING
MST_SFCC_ID*************");
System.out.println("Details:");
System.out.println("tReturn Code: " + returnCode);
System.out.println("tReturn Message: " + returnMsg);
}
}catch(Exception e){
e.printStackTrace();
}
}
response.sendRedirect(google_url);
}
}
}