use of org.olat.core.gui.control.ChiefController in project openolat by klemens.
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);
}
}
}
use of org.olat.core.gui.control.ChiefController in project openolat by klemens.
the class AuthHelper method createGuestHome.
/**
* Create a base chief controller for the current anonymous user request
* and initialize the first screen after login. Note, the user request
* must be authenticated, but as an anonymous user and not a known user.
*
* @param ureq The authenticated user request.
* @return The chief controller
*/
private static ChiefController createGuestHome(UserRequest ureq) {
if (!ureq.getUserSession().isAuthenticated())
throw new AssertException("not authenticated!");
BaseFullWebappControllerParts guestSitesAndNav = new GuestBFWCParts();
ChiefController cc = new BaseFullWebappController(ureq, guestSitesAndNav);
Windows.getWindows(ureq.getUserSession()).setChiefController(cc);
return cc;
}
use of org.olat.core.gui.control.ChiefController in project openolat by klemens.
the class AuthHelper method doLogin.
/**
* Used by DMZDispatcher to do regular logins and by ShibbolethDispatcher
* which is somewhat special because logins are handled asynchronuous ->
* therefore a dedicated dispatcher is needed which also has to have access to
* the doLogin() method.
*
* @param identity
* @param authProvider
* @param ureq
* @return True if success, false otherwise.
*/
public static int doLogin(Identity identity, String authProvider, UserRequest ureq) {
int initializeStatus = initializeLogin(identity, authProvider, ureq, false);
if (initializeStatus != LOGIN_OK) {
// login not successfull
return initializeStatus;
}
// do logging
ThreadLocalUserActivityLogger.log(OlatLoggingAction.OLAT_LOGIN, AuthHelper.class, LoggingResourceable.wrap(identity));
// brasato:: fix it
// successfull login, reregister window
ChiefController occ;
if (ureq.getUserSession().getRoles().isGuestOnly()) {
occ = createGuestHome(ureq);
} else {
occ = createAuthHome(ureq);
}
Window currentWindow = occ.getWindow();
currentWindow.setUriPrefix(WebappHelper.getServletContextPath() + DispatcherModule.PATH_AUTHENTICATED);
Windows.getWindows(ureq).registerWindow(currentWindow);
RedirectMediaResource redirect;
String redirectTo = (String) ureq.getUserSession().getEntry("redirect-bc");
if (StringHelper.containsNonWhitespace(redirectTo)) {
String url = WebappHelper.getServletContextPath() + DispatcherModule.PATH_AUTHENTICATED + redirectTo;
redirect = new RedirectMediaResource(url);
} else {
// redirect to AuthenticatedDispatcher
// IMPORTANT: windowID has changed due to re-registering current window -> do not use ureq.getWindowID() to build new URLBuilder.
URLBuilder ubu = new URLBuilder(WebappHelper.getServletContextPath() + DispatcherModule.PATH_AUTHENTICATED, currentWindow.getInstanceId(), "1");
StringOutput sout = new StringOutput(30);
ubu.buildURI(sout, null, null);
redirect = new RedirectMediaResource(sout.toString());
}
ureq.getDispatchResult().setResultingMediaResource(redirect);
return LOGIN_OK;
}
use of org.olat.core.gui.control.ChiefController in project openolat by klemens.
the class AuthHelper method createAuthHome.
/**
* Create a base chief controller for the current authenticated user request
* and initialize the first screen after login.
*
* @param ureq The authenticated user request.
* @return The chief controller
*/
public static ChiefController createAuthHome(UserRequest ureq) {
if (!ureq.getUserSession().isAuthenticated())
throw new AssertException("not authenticated!");
BaseFullWebappControllerParts authSitesAndNav = new AuthBFWCParts();
ChiefController cc = new BaseFullWebappController(ureq, authSitesAndNav);
Windows.getWindows(ureq.getUserSession()).setChiefController(cc);
return cc;
}
use of org.olat.core.gui.control.ChiefController in project openolat by klemens.
the class LayoutMain3ColsBackController method setAsFullscreen.
public void setAsFullscreen() {
ChiefController cc = getWindowControl().getWindowBackOffice().getChiefController();
if (cc != null) {
thebaseChief = cc;
thebaseChief.getScreenMode().setMode(Mode.full);
}
fullScreen = true;
}
Aggregations