package org.jboss.security.auth.spi;
import java.security.acl.Group;
import java.util.Map;
import javax.security.auth.Subject;
import javax.security.auth.callback.CallbackHandler;
import javax.security.auth.login.LoginException;
public class DatabaseCertLoginModule extends BaseCertLoginModule
{
private String dsJndiName;
private String rolesQuery = "select Role, RoleGroup from Roles where PrincipalID=?";
public void initialize(Subject subject, CallbackHandler callbackHandler,
Map sharedState, Map options)
{
super.initialize(subject, callbackHandler, sharedState, options);
dsJndiName = (String) options.get("dsJndiName");
if( dsJndiName == null )
dsJndiName = "java:/DefaultDS";
Object tmp = options.get("rolesQuery");
if( tmp != null )
rolesQuery = tmp.toString();
log.trace("DatabaseServerLoginModule, dsJndiName="+dsJndiName);
log.trace("rolesQuery="+rolesQuery);
}
protected Group[] getRoleSets() throws LoginException
{
String username = getUsername();
Group[] roleSets = Util.getRoleSets(username, dsJndiName, rolesQuery, this);
return roleSets;
}
}