[Building Sakai] Using the PasswordService from within the user tool

Jennings, Michael mike_jennings at unc.edu
Fri Sep 21 15:13:39 PDT 2012


I have made a customization to UNC sakai instance where we have the ability to enable/disable a account via a flag on the user table. That way you could create the account and if they are not enabled you can redirect the user to a Page for email validation and what not.

I will try and get around to creating a jira for this functionality this weekend if people would be interested in it.

The mod has the enable/disable function, the ability to flip the bit on the account Page and redirect a user if they are disabled to another location that is set in the sakai properties file.

Mike

Matthew Jones <matthew at longsight.com> wrote:



Because the PasswordService doesn't have an api in shared (and it isn't itself) in shared, I'm not sure you could do that. You probably could set their password as an random bit of strings though, it doesn't have to go through this service if you don't care if it *works* or not, just that it locks them out?

You could probably even just store it in the password field as "*"+their password, then just remove the first character to unlock. That's what the old unix lockout used to be right?

On Fri, Sep 21, 2012 at 5:22 PM, Brian Baillargeon <bbailla2 at uwo.ca<mailto:bbailla2 at uwo.ca>> wrote:
Hello,

Currently the user tool (sakai.createuser) adds users upon submitting the form. We want to ensure that we get the correct email addresses from our users, so we're trying to customize the tool to send the user an email with a validation token before their account gets created.

In doing this, my plan is to create a separate database table to temporarily store the information they've filled on the New User form until they've validated their email address. Since they insert their password, I need to encrypt it, and I found that BaseUserEdit encrypts passwords using org.sakaiproject.user.impl.PasswordService. So I'll store the user's inserted information including their encrypted password, and once the user has validated their email address I'll create their account with a random password and manually update their row in the SAKAI_USER table with the encrypted password from my table.

I'm having trouble using PasswordService from within the user project though.
So, to pull in PasswordService I have:
<dependency>
    <groupId>org.sakaiproject.kernel</groupId>
    <artifactId>sakai-kernel-impl</artifactId>
    <version>${sakai.kernel.version}</version>
</dependency>

I can compile a class that calls new PasswordService() without errors, but at runtime I'm getting:

2012-09-21 16:50:17,617  WARN http-8081-Processor25 org.sakaiproject.cheftool.VelocityPortletPaneledAction - Exception calling method doSave java.lang.reflect.InvocationTargetException (Caused by java.lang.NoClassDefFoundError: org/sakaiproject/user/impl/PasswordService)
java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.sakaiproject.cheftool.VelocityPortletPaneledAction.actionDispatch(VelocityPortletPaneledAction.java:657)
        at org.sakaiproject.cheftool.VelocityPortletPaneledAction.processAction(VelocityPortletPaneledAction.java:555)
        at org.sakaiproject.cheftool.ToolServlet.doGet(ToolServlet.java:230)
        at org.sakaiproject.cheftool.VelocityPortletPaneledAction.doGet(VelocityPortletPaneledAction.java:1086)
        at org.sakaiproject.cheftool.ToolServlet.doPost(ToolServlet.java:154)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:647)
        at org.sakaiproject.vm.ComponentServlet.service(ComponentServlet.java:56)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
        at org.sakaiproject.util.RequestFilter.doFilter(RequestFilter.java:598)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
        at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:659)
        at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:457)
        at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:359)
        at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:311)
        at org.sakaiproject.tool.impl.ActiveToolComponent$MyActiveTool.forward(ActiveToolComponent.java:511)
        at org.sakaiproject.portal.charon.SkinnableCharonPortal.forwardTool(SkinnableCharonPortal.java:1429)
        at org.sakaiproject.portal.charon.handlers.ToolHandler.doTool(ToolHandler.java:204)
        at org.sakaiproject.portal.charon.handlers.ToolHandler.doGet(ToolHandler.java:96)
        at org.sakaiproject.portal.charon.handlers.ToolHandler.doPost(ToolHandler.java:73)
        at org.sakaiproject.portal.charon.SkinnableCharonPortal.doPost(SkinnableCharonPortal.java:1224)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:647)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
        at org.sakaiproject.util.RequestFilter.doFilter(RequestFilter.java:659)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:172)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:879)
        at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
        at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
        at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
        at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
        at java.lang.Thread.run(Thread.java:662)
Caused by: java.lang.NoClassDefFoundError: org/sakaiproject/user/impl/PasswordService
        at org.sakaiproject.user.uservalidation.model.ValidatablePersonHibernateImpl.setPassword(ValidatablePersonHibernateImpl.java:70)
        at org.sakaiproject.user.tool.UsersAction.readUserForm(UsersAction.java:966)
        at org.sakaiproject.user.tool.UsersAction.doSave(UsersAction.java:665)
        ... 46 more
Caused by: java.lang.ClassNotFoundException: org.sakaiproject.user.impl.PasswordService
        at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
        ... 49 more

Does anybody have any suggestions as to how I can get PasswordService to work in this project?

For reference, the source code can be found at https://source.sakaiproject.org/svn/msub/uwo.ca/user/trunk/

Thanks,
Brian

_______________________________________________
sakai-dev mailing list
sakai-dev at collab.sakaiproject.org<mailto:sakai-dev at collab.sakaiproject.org>
http://collab.sakaiproject.org/mailman/listinfo/sakai-dev

TO UNSUBSCRIBE: send email to sakai-dev-unsubscribe at collab.sakaiproject.org<mailto:sakai-dev-unsubscribe at collab.sakaiproject.org> with a subject of "unsubscribe"

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://collab.sakaiproject.org/pipermail/sakai-dev/attachments/20120921/230a7c8a/attachment.html 


More information about the sakai-dev mailing list