本文整理汇总了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;
}
}