/** * @see I_CmsAuthorizationHandler#initCmsObject(HttpServletRequest) */ public CmsObject initCmsObject(HttpServletRequest request) { // check if "basic" authorization data is provided CmsObject cms = checkBasicAuthorization(request); // basic authorization successful? if (cms != null) { try { // register the session into OpenCms and // return successful logged in user return registerSession(request, cms); } catch (CmsException e) { // ignore and threat the whole login process as failed } } // failed return null; }
/** * @see org.opencms.security.I_CmsAuthorizationHandler#initCmsObject(javax.servlet.http.HttpServletRequest, org.opencms.security.I_CmsAuthorizationHandler.I_PrivilegedLoginAction) */ public CmsObject initCmsObject( HttpServletRequest request, I_CmsAuthorizationHandler.I_PrivilegedLoginAction loginAction) { return initCmsObject(request); }
/** * @see I_CmsAuthorizationHandler#initCmsObject(HttpServletRequest, String, String) */ public CmsObject initCmsObject(HttpServletRequest request, String userName, String pwd) throws CmsException { // first, try to validate the session CmsObject cms = initCmsObjectFromSession(request); if (cms != null) { return cms; } // try to login with the given credentials cms = OpenCms.initCmsObject(OpenCms.getDefaultUsers().getUserGuest()); // this will throw an exception if login fails cms.loginUser(userName, pwd); // register the session into OpenCms and // return successful logged in user return registerSession(request, cms); }
/** * Returns an instance of the configured authorization handler.<p> * * @return an instance of the configured authorization handler */ public I_CmsAuthorizationHandler getAuthorizationHandler() { if (CmsStringUtil.isEmptyOrWhitespaceOnly(m_authorizationHandler)) { return new CmsDefaultAuthorizationHandler(); } try { I_CmsAuthorizationHandler authorizationHandler = (I_CmsAuthorizationHandler)Class.forName( m_authorizationHandler).newInstance(); if (LOG.isInfoEnabled()) { LOG.info( Messages.get().getBundle().key( Messages.INIT_AUTHORIZATION_HANDLER_CLASS_SUCCESS_1, m_authorizationHandler)); } authorizationHandler.setParameters(m_runtimeProperties); return authorizationHandler; } catch (Throwable t) { LOG.error( Messages.get().getBundle().key( Messages.INIT_AUTHORIZATION_HANDLER_CLASS_INVALID_1, m_authorizationHandler), t); return new CmsDefaultAuthorizationHandler(); } }
/** * @see I_CmsAuthorizationHandler#initCmsObject(HttpServletRequest, String, String) */ public CmsObject initCmsObject(HttpServletRequest request, String userName, String pwd) throws CmsException { // first, try to validate the session CmsObject cms = initCmsObjectFromSession(request); if (cms != null) { return cms; } // try to login with the given credentials cms = OpenCms.initCmsObject(OpenCms.getDefaultUsers().getUserGuest()); // this will throw an exception if login fails cms.loginUser(userName, pwd); // register the session into OpenCms and // return successful logged in user return registerSession(request, cms); }
/** * Returns an instance of the configured authorization handler.<p> * * @return an instance of the configured authorization handler */ public I_CmsAuthorizationHandler getAuthorizationHandler() { if (CmsStringUtil.isEmptyOrWhitespaceOnly(m_authorizationHandler)) { return new CmsDefaultAuthorizationHandler(); } try { I_CmsAuthorizationHandler authorizationHandler = (I_CmsAuthorizationHandler)Class.forName( m_authorizationHandler).newInstance(); if (LOG.isInfoEnabled()) { LOG.info(Messages.get().getBundle().key( Messages.INIT_AUTHORIZATION_HANDLER_CLASS_SUCCESS_1, m_authorizationHandler)); } authorizationHandler.setParameters(m_runtimeProperties); return authorizationHandler; } catch (Throwable t) { LOG.error(Messages.get().getBundle().key( Messages.INIT_AUTHORIZATION_HANDLER_CLASS_INVALID_1, m_authorizationHandler), t); return new CmsDefaultAuthorizationHandler(); } }
/** * @see I_CmsAuthorizationHandler#initCmsObject(HttpServletRequest) */ public CmsObject initCmsObject(HttpServletRequest request) { // check if "basic" authorization data is provided CmsObject cms = checkBasicAuthorization(request); // basic authorization successful? if (cms != null) { try { // register the session into OpenCms and // return successful logged in user return registerSession(request, cms); } catch (CmsException e) { // ignore and threat the whole login process as failed } } // failed return null; }
/** * @see org.opencms.security.I_CmsAuthorizationHandler#initCmsObject(javax.servlet.http.HttpServletRequest, org.opencms.security.I_CmsAuthorizationHandler.I_PrivilegedLoginAction) */ public CmsObject initCmsObject(HttpServletRequest request, I_CmsAuthorizationHandler.I_PrivilegedLoginAction loginAction) { return initCmsObject(request); }
/** * @see org.opencms.security.CmsDefaultAuthorizationHandler#initCmsObject(javax.servlet.http.HttpServletRequest, org.opencms.security.I_CmsAuthorizationHandler.I_PrivilegedLoginAction) */ @Override public CmsObject initCmsObject(HttpServletRequest request, I_PrivilegedLoginAction loginAction) { CmsObject cms = initCmsObjectFromToken(request, loginAction); if (cms == null) { cms = super.initCmsObject(request, loginAction); } return cms; }