I've read a few discussions here that lead me to believe that creating custom UserProviders is generally deprecated in favor of authentication filters. Unfortunately my solution must do the following:
Thus is seems like my best choice is to create a UserProvider so that special actions occur when a user updates his profile. Is a UserProvider the right path in this situation or can this be accomplished with an authentication filter?
I've already written a UserProvider which should work, but I'm stuck on figuring out what bean definition I should use to activate it. Any clues here as well? The documentation is tough to find for this.
Hi Martin,
From my understanding of Authentication Filters I don't believe its possible to send changes made to the username, email address, etc from Clearspace to an external location without at least custom User Provider.
Since it sounds like you have already written this where exactly are you stuck at and whats not functioning properly? Thanks!
-Todd
Hey Todd,
Currently I'm stuck on finding the appropriate way to activate my UserProvider in Clearspace. I'm fairly sure I should use a Spring bean definition somewhere, but I can't find an example or documentation explaining this.
Martin
Hi Martin,
How did you create and implement this UserProvider? Did you use an overlay or did you modify the source directly? or something else?
-Todd
I basically just implemented the com.jivesoftware.spi.user.UserProvider interface. Did I set out on the wrong track?
Hi Martin,
Here is my recommendation for you. I would recommend creating a plugin to imlement this userProvider in your installation. Basically what you will want to do is create a plugin which has your custom user provider in it and in the spring.xml file override the userManager with your custom user provider. I have attached a template plugin which I created to this post. Here is what you will want to do:
Please let me know if any of this was unclear or if you need any help. Thanks!
-Todd
Thanks Todd. That's exactly what I needed.
Unfortunately it seems that now when Clearspace (I'm using Clearspace 2.5.2 -- I failed to mention that earlier, sorry) attempts to load the plugin, the classloader can't find the UserProvider class. Here is the relavant output from the logs:
16:33:19,973 [main] ERROR com.jivesoftware.community.lifecycle.JiveApplication - Error loading class [com.appcelerator.clearspace.AppceleratorUserProvider] for bean with name 'appceleratorUserProvider' defined in URL [file:/Users/martin/Downloads/jive_clearspace_community_standalone_2_5_2/jiveHome/cache/plugins/appceleratorauth/spring.xml]: problem with class file or dependent class; nested exception is java.lang.NoClassDefFoundError: com/jivesoftware/spi/user/UserProvider
org.springframework.beans.factory.CannotLoadBeanClassException: Error loading class [com.appcelerator.clearspace.AppceleratorUserProvider] for bean with name 'appceleratorUserProvider' defined in URL [file:/Users/martin/Downloads/jive_clearspace_community_standalone_2_5_2/jiveHome/cache/plugins/appceleratorauth/spring.xml]: problem with class file or dependent class; nested exception is java.lang.NoClassDefFoundError: com/jivesoftware/spi/user/UserProvider
Here is my spring.xml file where I've defined both the UserProvider and an AuthFilter I've been working on:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:util="http://www.springframework.org/schema/util"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:dwr="http://www.directwebremoting.org/schema/spring-dwr"
xmlns:cxf="http://cxf.apache.org/core"
xmlns:jaxws="http://cxf.apache.org/jaxws"
xsi:schemaLocation="
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd
http://www.directwebremoting.org/schema/spring-dwr http://www.directwebremoting.org/schema/spring-dwr-2.0.xsd
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd"
default-autowire="no">
<bean id="filterChainProxy" class="org.acegisecurity.util.FilterChainProxy">
<property name="filterInvocationDefinitionSource">
<value>
CONVERT_URL_TO_LOWERCASE_BEFORE_COMPARISON
PATTERN_TYPE_APACHE_ANT
/upgrade/**=httpSessionContextIntegrationFilter, upgradeAuthenticationFilter, upgradeExceptionTranslationFilter,jiveAuthenticationTranslationFilter
/post-upgrade/**=httpSessionContextIntegrationFilter, postUpgradeAuthenticationFilter, postUpgradeExceptionTranslationFilter,jiveAuthenticationTranslationFilter
/admin/**=httpSessionContextIntegrationFilter, sessionTrackingFilter, adminAuthenticationFilter, openfireAuthenticationFilter, adminExceptionTranslationFilter,jiveAuthenticationTranslationFilter
/rpc/xmlrpc=wsRequireSSLFilter, httpSessionContextIntegrationFilter, basicAuthenticationFilter, wsExceptionTranslator, jiveAuthenticationTranslationFilter, wsAccessTypeCheckFilter
/rpc/rest/**=wsRequireSSLFilter, httpSessionContextIntegrationFilter, basicAuthenticationFilter, wsExceptionTranslator, jiveAuthenticationTranslationFilter, wsAccessTypeCheckFilter
/rpc/soap/**=wsRequireSSLFilter, httpSessionContextIntegrationFilter, jiveAuthenticationTranslationFilter
/**=httpSessionContextIntegrationFilter, sessionTrackingFilter, appceleratorAuthFilter, formAuthenticationFilter, rememberMeProcessingFilter, feedBasicAuthenticationFilter,exceptionTranslationFilter,jiveAuthenticationTranslationFilter
</value>
</property>
</bean>
<!-- Define a new filter for externally-managed users. Inject dependencies as needed. -->
<bean id="appceleratorAuthFilter" class="com.appcelerator.clearspace.AppceleratorAuthFilter">
<property name="userManager" ref="userManagerImpl"/>
</bean>
<bean id="userManagerImpl" class="com.jivesoftware.base.profile.MultiProviderUserManager">
<property name="userIDCache" ref="userIDCache"/>
<property name="userCache" ref="userCache"/>
<property name="userDAO" ref="userDAO"/>
<property name="userContentExistsDAO" ref="userContentExistsDAO"/>
<property name="saltSource" ref="saltSource"/>
<property name="passwordEncoder" ref="passwordEncoder"/>
<property name="eventDispatcher" ref="userEventDispatcher"/>
<property name="userContainerManager" ref="userContainerManagerImpl"/>
<property name="userProviders">
<list>
<ref bean="appceleratorUserProvider"/>
</list>
</property>
</bean>
<bean id="appceleratorUserProvider" class="com.appcelerator.clearspace.AppceleratorUserProvider">
</bean>
</beans>
I'm not sure what's going on here, but perhaps I have a configuration issue?
Hi Martin,
Hmm that is very strange. You do have this in your code?
import com.jivesoftware.spi.user.UserProvider;
I would suggest looking at the custom auth filter because I believe they did something similar to what you did and it should be working:
https://svn.jivesoftware.com/svn/dev/repos/jive/plugins/custom-authentication/trunk/
Thanks.
-Todd
Yep, the import is there.
I actually did base my plugin on the custom-authentication plugin.
Could this be related to my use of the evaluation license? Our organization has a license, but for the purposes of plugin development, I'm using the evaluation license.
Also, I do notice that above the exception that I included I see:
Exception in thread "pool-1-thread-1" java.util.concurrent.RejectedExecutionException
at java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution(ThreadPoolExecutor.java:1477)
at java.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecutor.java:384)
at java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:856)
at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:31)
at com.jivesoftware.base.event.v2.NonBlockingEventDispatcherImpl$Watcher.run(NonBlockingEventDispatcherImpl.java:159)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
at java.lang.Thread.run(Thread.java:613)
Hi Martin,
That is an odd error, does that get thrown every time you start clearspace? I don't think that the evaluation license should matter in this case. It looks like this should be working so I am really not sure why it can't find that class.
-Todd
Nope, the exception is only thrown when the plugin is loaded in Clearspace.
Hi Martin,
Would it be possible to get a copy of the plugin that you are installing so I can do some testing locally and try to resolve this issue for you? Thanks.
-Todd
It seems that refreshing my Clearspace install and the database, this problem went away. It must have been a configuration issue. Thanks for the help!
Great! Happy to hear that you were able to get this working. Thanks for the update Martin.
-Todd
Jive combines the most powerful features of collaboration software, community software,
social networking software & social media monitoring into the leading SBS solution.
© Copyright 2000–2010 Jive Software. All rights reserved.
915 SW Stark St., Suite 400, Portland, OR 97205
Sales: 877-495-3700 | General: 503-295-3700
Privacy Policy | Sitemap | Jobs | Contact Us