1 7 package org.jboss.security.auth.spi; 8 9 import java.security.acl.Group ; 10 import java.util.Map ; 11 12 import javax.security.auth.Subject ; 13 import javax.security.auth.callback.CallbackHandler ; 14 import javax.security.auth.login.LoginException ; 15 16 28 public class DatabaseCertLoginModule extends BaseCertLoginModule 29 { 30 31 private String dsJndiName; 32 33 private String rolesQuery = "select Role, RoleGroup from Roles where PrincipalID=?"; 34 35 42 public void initialize(Subject subject, CallbackHandler callbackHandler, 43 Map sharedState, Map options) 44 { 45 super.initialize(subject, callbackHandler, sharedState, options); 46 dsJndiName = (String ) options.get("dsJndiName"); 47 if( dsJndiName == null ) 48 dsJndiName = "java:/DefaultDS"; 49 50 Object tmp = options.get("rolesQuery"); 51 if( tmp != null ) 52 rolesQuery = tmp.toString(); 53 54 log.trace("DatabaseServerLoginModule, dsJndiName="+dsJndiName); 55 log.trace("rolesQuery="+rolesQuery); 56 } 57 58 61 protected Group [] getRoleSets() throws LoginException 62 { 63 String username = getUsername(); 64 Group [] roleSets = Util.getRoleSets(username, dsJndiName, rolesQuery, this); 65 return roleSets; 66 } 67 68 } 69 | Popular Tags |