package com.blackboard.custom; import com.iplanet.sso.*; import java.net.*; import javax.servlet.http.*; import java.net.*; import java.util.*; import blackboard.platform.BbServiceManager; import blackboard.platform.log.LogService; import blackboard.platform.security.authentication.BaseAuthenticationModule; import blackboard.platform.security.authentication.BbAuthenticationFailedException; import blackboard.platform.security.authentication.BbCredentialsNotFoundException; import blackboard.platform.security.authentication.BbSecurityException; public class SJESIdentity6 extends BaseAuthenticationModule { LogService _logger; SSOToken token = null; /** * @param request * @param response * @throws BbSecurityException * @throws BbAuthenticationFailedException * @throws BbCredentialsNotFoundException * @return * * Retrieve from the header "userid" username and return * "userid" is the string configured to be returned in * AMAgent.properties file from the uid attribute in the directory server schema * See also the headerAttributes comments in the AMAgent.properties file. * **/ public String doAuthenticate(HttpServletRequest request, HttpServletResponse response) throws BbSecurityException, BbAuthenticationFailedException, BbCredentialsNotFoundException { // Get the default authentication techniques result String username = null; _logger.logInfo("SJES doAuthenticate, username = " + username); Enumeration enum = request.getHeaderNames(); _logger.logInfo("SJES After Enum"); if (enum.hasMoreElements()==false) { _logger.logInfo("SJES enum = empty"); } while (enum.hasMoreElements()){ String name = (String) enum.nextElement(); _logger.logInfo("SJES name = " + name); _logger.logInfo("SJES Value = " + request.getHeader(name)); } String uid = request.getHeader("userid"); _logger.logInfo("SJES doAuthenticate, uid = " + uid); username = uid; _logger.logInfo("SJES returning username = " + username); return username; } /** * @param request * @param response * @throws BbSecurityException * * Logout the user from the identity server using SSO API and Blackboard using super. * Also note that we have to destroy the cookie manually to update the agent cache and * hence avoid any incosistency * */ public void doLogout(HttpServletRequest request, HttpServletResponse response) throws BbSecurityException { try { _logger.logInfo("SJES doLogout" ); Cookie ssocookie = null; Cookie[] cookies = request.getCookies() ; String cName = (new com.iplanet.am.util.SystemProperties()).get("com.iplanet.am.cookie.name"); _logger.logInfo("SJES cookieName=" + cName); for (int k=0; k