001
014
015 package com.liferay.portal.security.auth;
016
017 import com.liferay.portal.kernel.spring.osgi.OSGiBeanProperties;
018 import com.liferay.portal.service.UserLocalServiceUtil;
019
020 import java.util.Map;
021
022
026 @OSGiBeanProperties(property = "key=auth.max.failures")
027 public class LoginMaxFailures implements AuthFailure {
028
029 @Override
030 public void onFailureByEmailAddress(
031 long companyId, String emailAddress,
032 Map<String, String[]> headerMap, Map<String, String[]> parameterMap)
033 throws AuthException {
034
035 try {
036 UserLocalServiceUtil.updateLockoutByEmailAddress(
037 companyId, emailAddress, true);
038 }
039 catch (Exception e) {
040 throw new AuthException();
041 }
042 }
043
044 @Override
045 public void onFailureByScreenName(
046 long companyId, String screenName, Map<String, String[]> headerMap,
047 Map<String, String[]> parameterMap)
048 throws AuthException {
049
050 try {
051 UserLocalServiceUtil.updateLockoutByScreenName(
052 companyId, screenName, true);
053 }
054 catch (Exception e) {
055 throw new AuthException();
056 }
057 }
058
059 @Override
060 public void onFailureByUserId(
061 long companyId, long userId, Map<String, String[]> headerMap,
062 Map<String, String[]> parameterMap)
063 throws AuthException {
064
065 try {
066 UserLocalServiceUtil.updateLockoutById(userId, true);
067 }
068 catch (Exception e) {
069 throw new AuthException();
070 }
071 }
072
073 }