while (true) {
switch (event) {
case START_ELEMENT:
name = reader.getName();
if(USER_QNAME.equals(name)) {
UserContext user = new UserContext();
//<tuscany:user username="user1" password="tuscany" roles="admin, user"/>
String username = reader.getAttributeValue(null, "username");
if(username == null) {
error("RequiredAttributeUsernameMissing", reader);
} else {
user.setUsername(username);
}
String password = reader.getAttributeValue(null, "password");
if(password == null) {
error("RequiredAttributePasswordMissing", reader);
} else {
user.setPassword(password);
}
String roles = reader.getAttributeValue(null, "roles");
if(roles == null) {
error("RequiredAttributeRolesMissing", reader);
} else {
for (StringTokenizer tokens = new StringTokenizer(roles, ","); tokens.hasMoreTokens();) {
user.getRoles().add(tokens.nextToken());
}
}
authenticationConfiguration.getUsers().add(user);
}