本文整理匯總了Java中com.liferay.portal.security.auth.AuthException類的典型用法代碼示例。如果您正苦於以下問題:Java AuthException類的具體用法?Java AuthException怎麽用?Java AuthException使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
AuthException類屬於com.liferay.portal.security.auth包,在下文中一共展示了AuthException類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: tentaAutenticar
import com.liferay.portal.security.auth.AuthException; //導入依賴的package包/類
private boolean tentaAutenticar(ActionRequest request, ActionResponse response, String email, String senha) {
MethodKey method = new MethodKey("com.liferay.portlet.login.util.LoginUtil", "login", new Class[] { HttpServletRequest.class,
HttpServletResponse.class, String.class, String.class, boolean.class, String.class });
try {
PortalClassInvoker.invoke(false, method, PortalUtil.getHttpServletRequest(request), PortalUtil.getHttpServletResponse(response), email, senha,
false, CompanyConstants.AUTH_TYPE_EA);
return true;
} catch (Exception e) {
if (e instanceof AuthException) {
Throwable cause = e.getCause();
if (cause != null) {
SessionErrors.add(request, cause.getClass());
salvarLastPathNaSessao(request);
} else {
SessionErrors.add(request, e.getClass());
salvarLastPathNaSessao(request);
}
} else {
SessionErrors.add(request, e.getClass());
}
return false;
}
}
示例2: tentarAutenticar
import com.liferay.portal.security.auth.AuthException; //導入依賴的package包/類
private boolean tentarAutenticar() {
MethodKey method = new MethodKey("com.liferay.portlet.login.util.LoginUtil", "login", new Class[] { HttpServletRequest.class,
HttpServletResponse.class, String.class, String.class, boolean.class, String.class });
ActionRequest request = (ActionRequest) LiferayFacesContext.getInstance().getPortletRequest();
ActionResponse response = (ActionResponse) LiferayFacesContext.getInstance().getPortletResponse();
HttpServletRequest httpServletRequest = getHttpServletRequest(request);
try {
PortalClassInvoker.invoke(false, method, httpServletRequest, PortalUtil.getHttpServletResponse(response), email, senha, false,
CompanyConstants.AUTH_TYPE_EA);
PortletSession session = request.getPortletSession(false);
if (session != null)
session.removeAttribute("email");
return true;
} catch (Exception e) {
if (e instanceof AuthException) {
Throwable cause = e.getCause();
if (cause != null)
SessionErrors.add(request, cause.getClass());
else
SessionErrors.add(request, e.getClass());
} else {
SessionErrors.add(request, e.getClass());
}
return false;
}
}