Personal tools
You are here: Home techsite tech prods dctm wdk dctm - wdk silent login
Navigation
 
Document Actions

dctm - wdk silent login

|logon login webtop autologin autologon|

The are rough notes.  Best thing is to see WDK Dev Docs and search for "silent" (as in "silent login").




New Props File for creds

In the class dir where SilientAuthenticationScheme compiles include the attached properties file. 
(in Eclipse, put it in the source dir where it will get copied)


SilentAuthentication.properties (file name)
yourdocbase=userid,password

Change Existing Props File

Change ….\WEB-INF\classes\com\documentum\web\formext\session\ AuthenticationSchemes.properties

As shown:

Add this line:
scheme_class.1=com.cendent.util.silentlogin.SilentAuthenticationScheme // change package has needed.

(in Eclipse, put in source dir....you may search the jars files for the SilentAuthentication.properties to modify)

Increment each of the other scheme_class.n lines i.e. 1 to 2, 2 to 3 etc.


New Class:

Include this SlientAuthenticationScheme in your project (change package name as needed)


<SlientAuthenticationScheme.java>
package com.xxx.util.silentlogin;
import java.io.*;
import java.util.*;
import javax.servlet.http.*;
import com.documentum.fc.common.*;
import com.documentum.web.common.ArgumentList;
import com.documentum.web.formext.session.*;
public class SilentAuthenticationScheme implements IAuthenticationScheme
{
/**
* Properties filename that contains the defined credentials.
*/
private static String RES_BUNDLE_NAME = "SilentAuthentication.properties";

/**
* Resource bundle that loads the credentials.
*/
private static PropertyResourceBundle s_resBundle = null;
/**
* Implements IAuthenticationScheme#authenticate(...)
* by reading credentials from the SilentAuthentication.properties file
* and creating sessions for the credentials.
* @param request HTTP request.
* @param response The HTTP response. Not used in this method.
* @param docbase Docbase name. Ignored in this implementation.
* @return docbase The docbase into which the user was logged in.
* For multiple credentials, the first docbase name in
* SilentAuthentication.properties is returned.
*/
public String authenticate(HttpServletRequest request,
HttpServletResponse response, String docbase) throws DfException {
IAuthenticationService service = AuthenticationService.getService();
HttpSession sess = request.getSession();
initCredentials();
Enumeration docbases = s_resBundle.getKeys();
String defaultDocbase = null;
while (docbases.hasMoreElements())
{
String docbaseName = (String) docbases.nextElement();
String value = s_resBundle.getString(docbaseName);
ArrayList creds = parseCredentials(value);
String username = (String) creds.get(0);
String password = (String) creds.get(1);
String domain = null;
if (creds.size() > 2)
{
domain = (String) creds.get(2);
}
service.login(sess, docbaseName, username, password, domain);
if (defaultDocbase == null)
{
defaultDocbase = docbaseName;
}
}//while
return defaultDocbase;
}
/**
* Implements IAuthenticationScheme#getLoginComponent(...).
* Return null because silent authentication does not have a login component
* @return null
*/
public String getLoginComponent(HttpServletRequest request, HttpServletResponse
response, String docbase, ArgumentList outArgs)
{
return null;
}
/**
* Loads the properties file that contains credentials
*/
protected void initCredentials()
{
try
{
if (s_resBundle == null)
{
InputStream is =
SilentAuthenticationScheme.class.getResourceAsStream(RES_BUNDLE_NAME);
s_resBundle = new PropertyResourceBundle(is);
}
}
catch (IOException ioe)
{
//error handling
}
}
/**
* Parses a string "username,password,domain" into an ArrayList object.
* @param creds ArrayList of credentials.
* At index: 0=>username 1=>password 2=>domain
* @return
*/
protected ArrayList parseCredentials(String creds)
{
ArrayList listCreds = new ArrayList(3);
StringTokenizer tokCreds = new StringTokenizer(creds, ",");
int cntr = 0;
while (tokCreds.hasMoreTokens())
{
String cred = tokCreds.nextToken();
listCreds.add(cntr, cred);
cntr++;
}
return listCreds;
}
}

</SlientAuthenticationScheme.java>

execute

Reboot Tomcat and open webtop…you should not get a auth challenge.







Powered by Plone CMS, the Open Source Content Management System

This site conforms to the following standards: