Posts

Showing posts with the label hook

Supported properties in hook by liferay

In Liferay we know that we can override some of the properties using hooks. To remember all those supported properties is quite difficult. Also how can we know  whether that particular properties  is supported or not ? So we have class called  HookHotDeployListener class to check the supported properties. Look into the  SUPPORTED_PROPERTIES string array variable where it listed all the supported properties. This is how it is listed public class HookHotDeployListener extends BaseHotDeployListener implements PropsKeys { public static final String[] SUPPORTED_PROPERTIES = { "admin.default.group.names", "admin.default.role.names", "admin.default.user.group.names", "asset.publisher.asset.entry.query.processors", "asset.publisher.display.styles", "asset.publisher.query.form.configuration", "auth.forward.by.last.path", "auth.public.paths", "auth.verifier.pipeline", "auto.deploy.liste...

Audting the Login Failure in liferay

In Liferay we can audit login failure for the user just by writing the hook. We have property which we need to add in portal.properties file as.        auth.failure = com.sample.events.hook.LoginFailureAudit. Then create a class and extend with the AuthFailure public class LoginFailureAudit implements AuthFailure {      public void onFailureByEmailAddress(long companyId, String emailAddress, Map<String, String[]> headerMap, Map<String, String[]> parameterMap) throws AuthException { long userId = UserLocalServiceUtil.getUserByScreenName(companyId, emailAddress).getUserId(); User user = UserLocalServiceUtil.getUser(userId); System.out.println("login failure attempts are"+user.getFailedLoginAttempts()); } public void onFailureByScreenName(long companyId, String screenName, Map<String, String[]> headerMap, Map<String, String[]> parameterMap) throws AuthException { long userId = UserLocalServiceUtil.g...