List of usage examples for com.liferay.portal.kernel.security.auth AuthException AuthException
public AuthException(String msg, Throwable cause)
From source file:blade.authenticator.shiro.ShiroAuthenticatorPre.java
License:Apache License
@Override public int authenticateByEmailAddress(long companyId, String emailAddress, String password, Map<String, String[]> headerMap, Map<String, String[]> parameterMap) throws AuthException { _log.info("authenticateByEmailAddress"); UsernamePasswordToken usernamePasswordToken = new UsernamePasswordToken(emailAddress, password); Subject currentUser = SecurityUtils.getSubject(); try {/*from w w w .j a va 2s . c om*/ currentUser.login(usernamePasswordToken); boolean authenticated = currentUser.isAuthenticated(); if (authenticated) { _log.info("authenticated"); return SKIP_LIFERAY_CHECK; } else { return FAILURE; } } catch (AuthenticationException e) { _log.error(e.getMessage(), e); throw new AuthException(e.getMessage(), e); } }
From source file:com.liferay.blade.samples.authenticator.shiro.ShiroAuthenticatorPre.java
License:Apache License
@Override public int authenticateByEmailAddress(long companyId, String emailAddress, String password, Map<String, String[]> headerMap, Map<String, String[]> parameterMap) throws AuthException { if (_log.isInfoEnabled()) { _log.info("authenticateByEmailAddress"); }//from w ww. j av a2 s. c o m UsernamePasswordToken usernamePasswordToken = new UsernamePasswordToken(emailAddress, password); Subject currentUser = SecurityUtils.getSubject(); try { currentUser.login(usernamePasswordToken); boolean authenticated = currentUser.isAuthenticated(); if (authenticated) { if (_log.isInfoEnabled()) { _log.info("authenticated"); } return SKIP_LIFERAY_CHECK; } else { return FAILURE; } } catch (AuthenticationException ae) { _log.error(ae.getMessage(), ae); throw new AuthException(ae.getMessage(), ae); } }