use of org.olat.core.gui.media.RedirectMediaResource in project openolat by klemens.
the class ViteroBookingsController method openVitero.
protected void openVitero(UserRequest ureq, ViteroBooking booking) {
try {
String url = viteroManager.getURLToBooking(ureq.getIdentity(), booking);
RedirectMediaResource redirect = new RedirectMediaResource(url);
ureq.getDispatchResult().setResultingMediaResource(redirect);
} catch (VmsNotAvailableException e) {
showError(VmsNotAvailableException.I18N_KEY);
}
}
use of org.olat.core.gui.media.RedirectMediaResource in project openolat by klemens.
the class GoToMeetingController method doConfirm.
private void doConfirm(UserRequest ureq) {
if (registrant != null) {
String confirmUrl = registrant.getConfirmUrl();
if (confirmUrl != null) {
RedirectMediaResource redirect = new RedirectMediaResource(confirmUrl);
ureq.getDispatchResult().setResultingMediaResource(redirect);
}
}
updateButtons();
}
use of org.olat.core.gui.media.RedirectMediaResource in project openolat by klemens.
the class ShibbolethDispatcher method execute.
/**
* Main method called by OpenOLATServlet.
* This processess all shibboleth requests.
*
* @param req
* @param resp
* @param uriPrefix
*/
@Override
public void execute(HttpServletRequest req, HttpServletResponse resp) {
if (translator == null) {
translator = Util.createPackageTranslator(ShibbolethDispatcher.class, I18nModule.getDefaultLocale());
}
if (!shibbolethModule.isEnableShibbolethLogins()) {
throw new OLATSecurityException("Got shibboleth request but shibboleth is not enabled");
}
String uriPrefix = DispatcherModule.getLegacyUriPrefix(req);
Map<String, String> attributesMap = getShibbolethAttributesFromRequest(req);
ShibbolethAttributes shibbolethAttriutes = CoreSpringFactory.getImpl(ShibbolethAttributes.class);
shibbolethAttriutes.init(attributesMap);
String uid = shibbolethAttriutes.getUID();
if (uid == null) {
handleException(new ShibbolethException(ShibbolethException.UNIQUE_ID_NOT_FOUND, "Unable to get unique identifier for subject. Make sure you are listed in the metadata.xml file and your resources your are trying to access are available and your are allowed to see them. (Resourceregistry). "), req, resp, translator);
return;
}
if (!authorization(req, resp, shibbolethAttriutes)) {
return;
}
UserRequest ureq = null;
try {
// upon creation URL is checked for
ureq = new UserRequestImpl(uriPrefix, req, resp);
} catch (NumberFormatException nfe) {
// a 404 message must be shown -> e.g. robots correct their links.
if (log.isDebug()) {
log.debug("Bad Request " + req.getPathInfo());
}
DispatcherModule.sendBadRequest(req.getPathInfo(), resp);
return;
}
Authentication auth = securityManager.findAuthenticationByAuthusername(uid, PROVIDER_SHIB);
if (auth == null) {
// no matching authentication...
ShibbolethRegistrationController.putShibAttributes(req, shibbolethAttriutes);
ShibbolethRegistrationController.putShibUniqueID(req, uid);
redirectToShibbolethRegistration(resp);
return;
}
if (ureq.getUserSession() != null) {
// re-init the activity logger
ThreadLocalUserActivityLoggerInstaller.initUserActivityLogger(req);
}
int loginStatus = AuthHelper.doLogin(auth.getIdentity(), ShibbolethDispatcher.PROVIDER_SHIB, ureq);
if (loginStatus != AuthHelper.LOGIN_OK) {
if (loginStatus == AuthHelper.LOGIN_NOTAVAILABLE) {
DispatcherModule.redirectToServiceNotAvailable(resp);
} else {
// error, redirect to login screen
DispatcherModule.redirectToDefaultDispatcher(resp);
}
return;
}
// Successful login
Identity authenticationedIdentity = ureq.getIdentity();
userDeletionManager.setIdentityAsActiv(authenticationedIdentity);
shibbolethManager.syncUser(authenticationedIdentity, shibbolethAttriutes);
ureq.getUserSession().getIdentityEnvironment().addAttributes(shibbolethModule.getAttributeTranslator().translateAttributesMap(shibbolethAttriutes.toMap()));
MediaResource mr = ureq.getDispatchResult().getResultingMediaResource();
if (mr instanceof RedirectMediaResource) {
RedirectMediaResource rmr = (RedirectMediaResource) mr;
rmr.prepare(resp);
} else {
// error, redirect to login screen
DispatcherModule.redirectToDefaultDispatcher(resp);
}
}
use of org.olat.core.gui.media.RedirectMediaResource in project openolat by klemens.
the class OpenMeetingsRecordingController method event.
@Override
protected void event(UserRequest ureq, Component source, Event event) {
if (source == downloadLink) {
try {
String url = openMeetingsManager.getRecordingURL(recording);
MediaResource downloadUrl = new RedirectMediaResource(url);
ureq.getDispatchResult().setResultingMediaResource(downloadUrl);
} catch (OpenMeetingsException e) {
logError("", e);
}
}
}
use of org.olat.core.gui.media.RedirectMediaResource in project openolat by klemens.
the class OpenMeetingsRunController method doStart.
private void doStart(UserRequest ureq) {
if (room == null && room.getRoomId() <= 0) {
showError("room.notfound.error");
} else {
try {
String securedHash = openMeetingsManager.setUserToRoom(getIdentity(), room.getRoomId(), moderator);
String url = openMeetingsManager.getURL(getIdentity(), room.getRoomId(), securedHash, getLocale());
RedirectMediaResource redirect = new RedirectMediaResource(url);
ureq.getDispatchResult().setResultingMediaResource(redirect);
} catch (OpenMeetingsException e) {
showError(e.i18nKey());
}
}
}
Aggregations