Search code examples
liferay-6

How to override default Liferay Login authentication?


I am using Liferay 6.1, and I want to override default Liferay Login authentication and want to set up my custom authentication.

Till now what I have done is, I have created a hook-plugin and have setup following properties in portal.properties file

auth.pipeline.pre=com.liferay.portal.security.auth.MyCustomAuthenticator
auth.pipeline.enable.liferay.check=false

where MyCustomAuthenticator is my custom authenticator class ( which implements Authenticator).

Currently, Liferay checks this custom authentication 1st, but then again it goes to Liferay itself for further Liferay authentication too.

I want to override this Liferay validation. Please help me solve this issue. Here is my authenticator class:

public class MyCustomAuthenticator implements Authenticator {  

  public int authenticateByEmailAddress(long arg0, String arg1, String arg2, Map<String, String[]> arg3, Map<String, String[]> arg4) throws AuthException {  

    System.out.println("succeeded by mail");  
    return SUCCESS;  
  }  

 public int authenticateByScreenName(long arg0, String arg1, String arg2, Map<String, String[]> arg3, Map<String, String[]> arg4) throws AuthException {  

    System.out.println("succeeded by screen name");  
    return SUCCESS;  
  }  

 public int authenticateByUserId(long arg0, long arg1, String arg2, Map<String, String[]> arg3, Map<String, String[]> arg4) throws AuthException {  

    System.out.println("succeeded by user id");  
    return SUCCESS;  
  }  

}  

Solution

  • Add the following property in portal-ext.properties and then restart the server

    auth.pipeline.enable.liferay.check=false