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