Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
package com.documentum.web.formext.session;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import com.documentum.fc.client.IDfSession;
import com.documentum.fc.client.IDfSessionManager;
import com.documentum.fc.common.DfException;
import com.documentum.fc.common.DfLoginInfo;
import com.documentum.fc.common.IDfLoginInfo;
/**
* @author Andrey B. Panfilov <andrey@panfilov.tel>
*/
public class AuthenticationServiceCustom extends AuthenticationService {
public AuthenticationServiceCustom() {
super();
}
@Override
public void login(HttpSession httpSession, String principalName,
String docbase, HttpServletRequest req)
throws DfException {
super.login(httpSession, principalName, docbase, req);
replaceTicket(docbase);
}
@Override
public void login(HttpSession httpSession, String principalName,
String docbase)
throws DfException {
super.login(httpSession, principalName, docbase);
replaceTicket(docbase);
}
@Override
public void login(HttpSession httpSession, String docbase,
String userLoginName, String userPassword, String domain)
throws PasswordExpiredException, DfException {
super.login(httpSession, docbase, userLoginName, userPassword, domain);
replaceTicket(docbase);
}
@Override
public void login(HttpSession httpSession, String docbase, String domain,
Object binaryCredential)
throws DfException {
super.login(httpSession, docbase, domain, binaryCredential);
replaceTicket(docbase);
}
@Override
public void login(HttpSession httpSession, String docbase, String domain,
Object binaryCredential, HttpServletRequest req)
throws DfException {
super.login(httpSession, docbase, domain, binaryCredential, req);
replaceTicket(docbase);
}
@Override
public void login(HttpSession httpSession, String docbase,
String userLoginName, String password, String domain,
HttpServletRequest req)
throws DfException {
super.login(httpSession, docbase, userLoginName, password, domain, req);
replaceTicket(docbase);
}
private void replaceTicket(String docbase) throws DfException {
IDfSessionManager sessionManager = SessionManagerHttpBinding
.getSessionManager();
IDfSession session = null;
try {
int dotIndex = docbase.indexOf('.');
if (dotIndex != -1) {
docbase = docbase.substring(0, dotIndex);
}
session = sessionManager.getSession(docbase);
int timeout = session.getServerConfig()
.getInt("max_login_ticket_timeout");
String ticket = session.getLoginTicketEx(null, "docbase", timeout,
false, docbase);
String userName = session.getLoginUserName();
if (sessionManager.hasIdentity(docbase)) {
sessionManager.clearIdentity(docbase);
}
IDfLoginInfo loginInfo = new DfLoginInfo(userName, ticket);
sessionManager.setIdentity(docbase, loginInfo);
} finally {
if (session != null) {
sessionManager.release(session);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.