}
public Map<String, Object> getUserAttributes(String realmName, String username) {
try {
User user = getRealm(realmName).getUser(username);
Map<String, Object> m = new HashMap<String, Object>();
Enumeration e = user.getAttributeNames();
List<String> attrNames = new ArrayList<String>();
while (e.hasMoreElements()) {
attrNames.add((String)e.nextElement());
}
for (String attrName : attrNames) {
m.put(attrName, user.getAttribute(attrName));
}
return m;
} catch (Exception e) {
throw new RuntimeException(e);
}