/** * Logs a system user in to OpenCms.<p> * * @param userName the users name * @param password the password */ public void login(String userName, String password) { login(userName, password, null); }
/** * Logs a system user in to OpenCms.<p> * * @param userName the users name * @param password the password */ public void login(String userName, String password) { login(userName, password, null); }
/** * @see org.opencms.jsp.CmsJspLoginBean#login(java.lang.String, java.lang.String, java.lang.String) */ @Override public void login(String userName, String password, String projectName) { super.login(userName, password, projectName); if (isLoginSuccess()) { CmsObject cms = getCmsObject(); CmsPersistentLoginTokenHandler tokenHandler = new CmsPersistentLoginTokenHandler(); tokenHandler.setTokenLifetime(m_tokenLifetime); try { final String token = tokenHandler.createToken(cms); Cookie cookie = new Cookie(CmsPersistentLoginAuthorizationHandler.COOKIE_NAME, token); cookie.setMaxAge((int)(m_tokenLifetime / 1000)); cookie.setPath(getCookiePath(true)); getResponse().addCookie(cookie); m_isTokenSet = true; } catch (CmsException e) { LOG.error(e.getMessage(), e); } } }
/** * Logs a system user in to OpenCms.<p> * * Note that if a login project name is provided, this project must exist, * otherwise the login is regarded as a failure even if the user data was correct.<p> * * @param userName the users name * @param password the password * @param projectName the project to switch to after login (if null project is not switched) * @param redirectUri the URI to redirect to after login (if null the current URI is used) * * @throws IOException in case redirect after login was not successful */ public void login(String userName, String password, String projectName, String redirectUri) throws IOException { login(userName, password, projectName); if (m_loginException == null) { if (redirectUri != null) { getResponse().sendRedirect( OpenCms.getLinkManager().substituteLink(getCmsObject(), redirectUri, null, true)); } else { getResponse().sendRedirect(getFormLink()); } } }
/** * Logs a system user in to OpenCms.<p> * * Note that if a login project name is provided, this project must exist, * otherwise the login is regarded as a failure even if the user data was correct.<p> * * @param userName the users name * @param password the password * @param projectName the project to switch to after login (if null project is not switched) * @param redirectUri the URI to redirect to after login (if null the current URI is used) * * @throws IOException in case redirect after login was not successful */ public void login(String userName, String password, String projectName, String redirectUri) throws IOException { login(userName, password, projectName); if (m_loginException == null) { if (redirectUri != null) { getResponse().sendRedirect( OpenCms.getLinkManager().substituteLink(getCmsObject(), redirectUri, null, true)); } else { getResponse().sendRedirect(getFormLink()); } } }