Thanks, it works. :-)
David Sean Taylor schrieb:
On Jun 3, 2009, at 8:12 AM, Frank Otto wrote:
Hi,
I'm missing following methods in jetspeed 2.2 api:
User.getUserAttributes()
UserManager.setPassword()
Right, a major version upgrade, we deprecated methods in the security
improvements
See examples below for new 2.2 usage
Which methods I have to use instead?
For setting the password, you may want to try code like this:
User user = userManager.getUser(userName);
PasswordCredential pwc =
userManager.getPasswordCredential(user);
pwc.setPassword(null, newPassword);
pwc.setUpdateRequired(true);
userManager.storePasswordCredential(pwc);
The setPassword method appears to take two parameters. The first
parameter is the old password, and the second parameter is the new
password. By setting the first parameter to null, you can ignore the old
password and force update.
For User Attributes, there are some new methods available. Try one of
these methods,
SecurityAttributes getSecurityAttributes();
Map<String, String> getInfoMap();
depending on what kind of user attributes you need. A SecurityAttribute
can now have 'types' or 'categories'. The type of a security attribute
can be user defined (requiring Spring configuration), or there are
provided security attribute types:
info : built-in supported SecurityAttributeType category "info". This
category is also used for custom/extended attributes which are not
pre-defined. In laymen's terms, thats the old User Info attributes from
2.1.3
A code snippet of retrieving User Info attributes could be:
Map<String, SecurityAttribute> userAttributes =
user.getSecurityAttributes().getAttributeMap();
String cookie = getUserAttribute(userAttributes,
"user.cookie", username);
or updating
user.getSecurityAttributes().getAttribute("user.cookie",
true).setStringValue("somevalue"));
userManager.updateUser(user);
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]