| 1 16 package org.outerj.daisy.authentication; 17 18 import org.apache.avalon.framework.configuration.Configuration; 19 import org.apache.avalon.framework.configuration.ConfigurationException; 20 import org.outerj.daisy.authentication.UserCreator; 21 22 23 public class UserCreatorFactory { 24 public static UserCreator createUser(Configuration config, String scheme) throws ConfigurationException { 25 Configuration createUserConf = config.getChild("autoCreateUser", false); 26 if (createUserConf != null) { 27 Configuration[] rolesConf = createUserConf.getChild("roles").getChildren("role"); 28 String [] roles = new String [rolesConf.length]; 29 for (int i = 0; i < rolesConf.length; i++) { 30 roles[i] = rolesConf[i].getValue(); 31 } 32 String defaultRole = createUserConf.getChild("defaultRole").getValue(null); 33 boolean updateableByUser = createUserConf.getChild("updateableByUser").getValueAsBoolean(); 34 return new UserCreator(roles, defaultRole, updateableByUser, scheme); 35 } 36 return null; 37 } 38 } 39 | Popular Tags |