cancel
Showing results for 
Search instead for 
Did you mean: 

How works the Share login?

anusk
Champ in-the-making
Champ in-the-making
Hi,

I'm trying to customize the Share login to show messages in a prompt basing on password policies from ldap server.
I made a custom LDAPAuthenticationComponentImpl (here I check the policies), and if I login in Share, I know it ends on my custom class (so the authentication of Share is on Explorer??), but I can't see the way to communicate from there to Share. I thought on session variable, but I can't use FacesContext.
I try to take a look to the loginform on Share login, but I can't find where is the action or webscript called "share/page/dologin".

So basically, is there any way to relate a flag on Explorer to Share? Where is the "share/page/dologin" implementation?
Maybe I approach this thing completely wrong since my quite short experience on Share. Any advice would be appreciate.

Thanks in advanced,
Ana
2 REPLIES 2

sanjaymk
Champ in-the-making
Champ in-the-making
Hi,

I'm trying to customize the Share login to show messages in a prompt basing on password policies from ldap server.
I made a custom LDAPAuthenticationComponentImpl (here I check the policies), and if I login in Share, I know it ends on my custom class (so the authentication of Share is on Explorer??), but I can't see the way to communicate from there to Share. I thought on session variable, but I can't use FacesContext.
I try to take a look to the loginform on Share login, but I can't find where is the action or webscript called "share/page/dologin".

So basically, is there any way to relate a flag on Explorer to Share? Where is the "share/page/dologin" implementation?
Maybe I approach this thing completely wrong since my quite short experience on Share. Any advice would be appreciate.

Thanks in advanced,
Ana

Hi Ana,

just out of curiosity, I tried to research the share login.  Share is a Spring SURF based application MVC application.  Keeping that in mind, here is what I found -

1) The /doLogin is mapped to a loginController in the file slingshot-application-context.xml(<tomcat-installation>/webapps/share/WEB-INF/classes/alfresco)

2) The loginController class is in the jar spring-surf-1.0.0.CI-SNAPSHOT.jar in the lib folder

The LoginController implementation calls handleRequestInternal to do the actual authentication, and it has a request and response passed in, so you can store your value using a session variable.

So, in order to test this, first, I inherited from LoginController and implemented the handleRequestInternal method, second, added an entry for the /loginController in the context file and deployed it.  BOOM! I got the dreaded NullPointerException.  Smiley Very Happy  Turns out that there is a setUserFactory(UserFactory userFactory) not mentioned in the above JAVA Doc API, that needs to be set with a userFactory using a ConfigBean.  I didn't find much information or documentation on how to set the UserFactory using the ConfigBean.  So, if anybody in this rather quiet forum has clues or info on how to set this object, it would work OR atleast go to the next step.

Below is my implementation of the LoginController -


package gov.phila.city;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.extensions.surf.UserFactory;
import org.springframework.extensions.surf.mvc.LoginController;
import org.springframework.web.servlet.ModelAndView;

public class MyLoginController extends LoginController {

   @Override
   public ModelAndView handleRequestInternal(HttpServletRequest arg0,
         HttpServletResponse arg1) throws Exception
   {
      System.out.println("MyLoginController");
      return super.handleRequestInternal(arg0, arg1);
   }

   @Override
   public void setUserFactory(UserFactory userFactory) {

      System.out.println("setUserFactory");
      super.setUserFactory(userFactory);
   }

}






Thanks,
Sanjay.

zladuric
Champ on-the-rise
Champ on-the-rise
You would have to inject it with your bean initialization. Just create a standard setter and add userFactory bean as a dependency of your new login bean.

Alternatively, you can use
UserFactory userFactory = FrameworkUtil.getServiceRegistry().getUserFactory();
, like I have in an older bit of code, but Eclipse tells me this is now a deprecated way of doing it.