In the middle of converting SSO I wrote in 1.10x. Running into an issue with getting an instance of the profile. Essentially I update the profile through my SSO implimentaion.
The following code is raising a NullPointerException.
Map<Long, ProfileFieldValue> profile = profileManager.getProfile(user);
The extension is defined below.
public ProfileManager getProfileManager()
{
return profileManager;
}
public void setProfileManager(ProfileManager profileManager)
{
this.profileManager = profileManager;
}
public ProfileFieldManager getProfileFieldManager()
{
return profileFieldManager;
}
Where am I going wrong is there an article on this outside of the Javadocs.
Thaanks
Ray,
Are you injecting the profile manager via spring into your SSO solution (Filter?)? If you have a debugger attached to your environment, you might try putting a break point on the setter (or adding a log message otherwise) for the ProfileManager to make sure the system is injecting it properly. If that setter is not invoked, you are likely missing a spring configuration directive for your SSO module.
-erik
Hello Erik,
As far as injection is it enough to use the setters? See below? What else am I missing?
public ProfileManager getProfileManager()
{
return profileManager;
}
public void setProfileManager(ProfileManager profileManager)
{
this.profileManager = profileManager;
}
public ProfileFieldManager getProfileFieldManager()
{
return profileFieldManager;
}
public void setProfileFieldManager(ProfileFieldManager profileFieldManager)
{
this.profileFieldManager = profileFieldManager;
}
EMC Developer & ISV Relations
508-249-1725
mailto:harvey_raymond@emc.com
Ray, those setters are fine for injection, but you won't have them "autowired" in a plugin/SSO situation. You will need to define a spring configuration that injects the manager as part of your SSO implementation. I'll post a link to how to configure this via a plugin or jiveHome/etc file.
Ray, did you create a Spring configuration file that describes your SSO provider's dependencies, such as its dependency on the ProfileManager?
No I did not. However Eric had a how to link on configuring this via a
plugin or jiveHome/etc file.
EMC Developer & ISV Relations
508-249-1725
mailto:harvey_raymond@emc.com
Cool. Yep, the example on how to set up an SSO filter includes an XML stanza that shows properties defined for each of the injected dependencies (managers and agents). That stanza tells Spring what will be required at run time. We have another, similar example in the topic on adding DB access to a plugin. It's not SSO or authentication, but it is about making Spring aware of a component and its dependencies.
If you're deploying your SSO provider inside a plugin, then you'll want to include a spring.xml file in the plugin (the spring.xml file goes at the root of the deployed JAR). There's higher-level information about plugin deployment in Building Plugins. If instead you're adding your SSO provider to the classpath manually, outside the plugin framework, then you'll need to put your spring.xml file in the jiveHome/etc directory of your Clearspace instance.
For other info, you might find our (small, but growing) Spring FAQ useful. Also, check out the Spring documentation on its inversion of control (IoC) container (which is what's behind dependency injection).
Finally, we have two samples you might be interested in (both in our public Subversion project). One is Erik's on doing SSO; the other does Spring stuff for database access.
Okay this is very helpful thanks. I will let you know how I make out.
cheers
EMC Developer & ISV Relations
508-249-1725
mailto:harvey_raymond@emc.com
Jive combines collaboration software, community software & social networking software into the leading SBS solution.
© Copyright 2000–2009 Jive Software. All rights reserved.
915 SW Stark St., Suite 400, Portland, OR 97205