AuthorizationGenerator feels like a nice way to achieve what I want. However, I can't seem to get addAttribute() method to work, not sure if I'm doing something wrong.
public class MyAuthorizationGenerator<U extends CommonProfile> implements AuthorizationGenerator<U> {
@Override
public void generate(final U profile) {
profile.addAttribute("hello", "world");
}
}
In my SecurityConfig, I've defined the AuthorizationGenerator as follows;
final TwitterClient twitterClient = new TwitterClient(twitterAPIKey, twitterAPISecret);
twitterClient.addAuthorizationGenerator(new MyAuthorizationGenerator());
Finally, I try to retrieve the attribute as shown below, but it always returns
null.
profile.getAttribute("hello");
I've also tried setting the a role in the AuthorizationGenerator for a profile, and that works fine - can't seem to figure out why setting attribute will not work. Am I doing something wrong here?