Search in sources :

Example 1 with ChiefController

use of org.olat.core.gui.control.ChiefController in project OpenOLAT by OpenOLAT.

the class ShibbolethDispatcher method handleException.

/**
 * It first tries to catch the frequent SAMLExceptions and to ask the user to login again.
 * It basically lets the user to login again without getting a RedScreen if one of the most
 * frequent shibboleth error occurs. Else a RedScreen is the last option.
 * @param e
 * @param req
 * @param resp
 */
private void handleException(Throwable e, HttpServletRequest req, HttpServletResponse resp, Translator transl) {
    UserRequest ureq = new UserRequestImpl(ShibbolethDispatcher.PATH_SHIBBOLETH, req, resp);
    if (e instanceof ShibbolethException) {
        String userMsg = "";
        int errorCode = ((ShibbolethException) e).getErrorCode();
        switch(errorCode) {
            case ShibbolethException.GENERAL_SAML_ERROR:
                userMsg = transl.translate("error.shibboleth.generic");
                break;
            case ShibbolethException.UNIQUE_ID_NOT_FOUND:
                userMsg = transl.translate("error.unqueid.notfound");
                break;
            default:
                userMsg = transl.translate("error.shibboleth.generic");
                break;
        }
        showMessage(ureq, "org.opensaml.SAMLException: " + e.getMessage(), e, userMsg, ((ShibbolethException) e).getContactPersonEmail());
        return;
    } else {
        try {
            ChiefController msgcc = MsgFactory.createMessageChiefController(ureq, new OLATRuntimeException("Error processing Shibboleth request: " + e.getMessage(), e), false);
            msgcc.getWindow().dispatchRequest(ureq, true);
        } catch (Throwable t) {
            log.error("We're fucked up....", t);
        }
    }
}
Also used : OLATRuntimeException(org.olat.core.logging.OLATRuntimeException) ChiefController(org.olat.core.gui.control.ChiefController) UserRequest(org.olat.core.gui.UserRequest) UserRequestImpl(org.olat.core.gui.UserRequestImpl)

Example 2 with ChiefController

use of org.olat.core.gui.control.ChiefController in project OpenOLAT by OpenOLAT.

the class ShibbolethDispatcher method authorization.

private boolean authorization(HttpServletRequest req, HttpServletResponse resp, ShibbolethAttributes shibbolethAttibutes) {
    boolean authorized = false;
    if (shibbolethModule.isAccessControlByAttributes()) {
        if (StringHelper.containsNonWhitespace(shibbolethModule.getAttribute1()) && StringHelper.containsNonWhitespace(shibbolethModule.getAttribute1Values())) {
            authorized |= authorization(shibbolethModule.getAttribute1(), shibbolethModule.getAttribute1Values(), shibbolethAttibutes);
        }
        if (StringHelper.containsNonWhitespace(shibbolethModule.getAttribute2()) && StringHelper.containsNonWhitespace(shibbolethModule.getAttribute2Values())) {
            authorized |= authorization(shibbolethModule.getAttribute2(), shibbolethModule.getAttribute2Values(), shibbolethAttibutes);
        }
    } else {
        authorized = true;
    }
    if (!authorized) {
        UserRequest ureq = new UserRequestImpl(ShibbolethDispatcher.PATH_SHIBBOLETH, req, resp);
        String userMsg = translator.translate("error.shibboleth.not.authorized");
        ChiefController msgcc = MessageWindowController.createMessageChiefController(ureq, null, userMsg, null);
        msgcc.getWindow().dispatchRequest(ureq, true);
    }
    return authorized;
}
Also used : ChiefController(org.olat.core.gui.control.ChiefController) UserRequest(org.olat.core.gui.UserRequest) UserRequestImpl(org.olat.core.gui.UserRequestImpl)

Example 3 with ChiefController

use of org.olat.core.gui.control.ChiefController in project OpenOLAT by OpenOLAT.

the class ShibbolethDispatcher method showMessage.

/**
 * @param ureq
 * @param exceptionLogMessage will be recorded into the log file
 * @param cause
 * @param userMessage gets shown to the user
 * @param supportEmail if any available, else null
 */
private void showMessage(UserRequest ureq, String exceptionLogMessage, Throwable cause, String userMessage, String supportEmail) {
    ChiefController msgcc = MessageWindowController.createMessageChiefController(ureq, new OLATRuntimeException(exceptionLogMessage, cause), userMessage, supportEmail);
    msgcc.getWindow().dispatchRequest(ureq, true);
}
Also used : OLATRuntimeException(org.olat.core.logging.OLATRuntimeException) ChiefController(org.olat.core.gui.control.ChiefController)

Example 4 with ChiefController

use of org.olat.core.gui.control.ChiefController in project OpenOLAT by OpenOLAT.

the class QTI21AssessmentMainLayoutController method setAsFullscreen.

public void setAsFullscreen(UserRequest ureq) {
    ChiefController cc = getWindowControl().getWindowBackOffice().getChiefController();
    if (cc != null) {
        thebaseChief = cc;
        thebaseChief.getScreenMode().setMode(Mode.full);
    } else {
        Windows.getWindows(ureq).setFullScreen(Boolean.TRUE);
    }
    fullScreen = true;
}
Also used : ChiefController(org.olat.core.gui.control.ChiefController)

Example 5 with ChiefController

use of org.olat.core.gui.control.ChiefController in project OpenOLAT by OpenOLAT.

the class LTIRunController method openBasicLTIContent.

private void openBasicLTIContent(UserRequest ureq) {
    // container is "run", "runFullscreen" or "runPopup" depending in configuration
    doBasicLTI(ureq, run);
    if (display == LTIDisplayOptions.fullscreen) {
        ChiefController cc = getWindowControl().getWindowBackOffice().getChiefController();
        if (cc != null) {
            thebaseChief = cc;
            thebaseChief.getScreenMode().setMode(Mode.full);
        }
        fullScreen = true;
        getWindowControl().pushToMainArea(run);
    } else {
        mainPanel.setContent(run);
    }
}
Also used : ChiefController(org.olat.core.gui.control.ChiefController)

Aggregations

ChiefController (org.olat.core.gui.control.ChiefController)58 UserRequest (org.olat.core.gui.UserRequest)10 UserRequestImpl (org.olat.core.gui.UserRequestImpl)10 IOException (java.io.IOException)8 Window (org.olat.core.gui.components.Window)8 InvalidRequestParameterException (org.olat.core.gui.components.form.flexible.impl.InvalidRequestParameterException)8 WindowControl (org.olat.core.gui.control.WindowControl)8 OLATRuntimeException (org.olat.core.logging.OLATRuntimeException)8 ArrayList (java.util.ArrayList)6 BaseFullWebappController (org.olat.core.commons.fullWebApp.BaseFullWebappController)6 StringOutput (org.olat.core.gui.render.StringOutput)6 URLBuilder (org.olat.core.gui.render.URLBuilder)6 AssertException (org.olat.core.logging.AssertException)6 UserSession (org.olat.core.util.UserSession)6 HttpSession (javax.servlet.http.HttpSession)4 BaseFullWebappControllerParts (org.olat.core.commons.fullWebApp.BaseFullWebappControllerParts)4 Windows (org.olat.core.gui.Windows)4 CloseableModalController (org.olat.core.gui.control.generic.closablewrapper.CloseableModalController)4 RedirectMediaResource (org.olat.core.gui.media.RedirectMediaResource)4 ContextEntry (org.olat.core.id.context.ContextEntry)4