private boolean isSecurityEnabled() { Boolean b = (Boolean) getServletContext() .getAttribute(WebAppProxy.IS_SECURITY_ENABLED_ATTRIBUTE); return b != null ? b : false; }
@Override protected final void doPut(final HttpServletRequest req, final HttpServletResponse resp) throws ServletException, IOException { methodAction(req, resp, HTTP.PUT); }
boolean userWasWarned = false; boolean userApproved = Boolean.parseBoolean(userApprovedParamS); boolean securityEnabled = isSecurityEnabled(); final String remoteUser = req.getRemoteUser(); final String pathInfo = req.getPathInfo(); notFound(resp, "Your path appears to be formatted incorrectly."); return; LOG.warn("{} attempting to access {} that is invalid", remoteUser, appId); notFound(resp, appId + " appears to be formatted incorrectly."); return; String cookieName = getCheckCookieName(id); Cookie[] cookies = req.getCookies(); if (cookies != null) { ApplicationReport applicationReport = null; try { fetchedAppReport = getApplicationReport(id); if (fetchedAppReport != null) { if (fetchedAppReport.getAppReportSource() != AppReportSource.RM && notFound(resp, "Application " + appId + " could not be found " + "in RM or history server"); return; + "app master GUI of {} owned by {}",
boolean userWasWarned = false; boolean userApproved = Boolean.parseBoolean(userApprovedParamS); boolean securityEnabled = isSecurityEnabled(); boolean isRedirect = false; String pathInfo = req.getPathInfo(); notFound(resp, "Your path appears to be formatted incorrectly."); return; LOG.warn("{} attempting to access {} that is invalid", remoteUser, appId); notFound(resp, appId + " appears to be formatted incorrectly."); return; if (isRedirect && handleRedirect(appId, req, resp)) { return; String cookieName = getCheckCookieName(id); Cookie[] cookies = req.getCookies(); if (cookies != null) { fetchedAppReport = getFetchedAppReport(id); } catch (ApplicationNotFoundException e) { fetchedAppReport = null; notFound(resp, "Application " + appId + " could not be found " + "in RM or history server"); return;
private static Cookie makeCheckCookie(ApplicationId id, boolean isSet) { Cookie c = new Cookie(getCheckCookieName(id),String.valueOf(isSet)); c.setPath(ProxyUriUtils.getPath(id)); c.setMaxAge(60 * 60 * 2); //2 hours in seconds return c; }
/** * Warn the user that the link may not be safe! * @param resp the http response * @param link the link to point to * @param user the user that owns the link. * @throws IOException on any error. */ private static void warnUserPage(HttpServletResponse resp, String link, String user, ApplicationId id) throws IOException { //Set the cookie when we warn which overrides the query parameter //This is so that if a user passes in the approved query parameter without //having first visited this page then this page will still be displayed resp.addCookie(makeCheckCookie(id, false)); resp.setContentType(MimeType.HTML); Page p = new Page(resp.getWriter()); p.html(). h1("WARNING: The following page may not be safe!"). h3(). _("click ").a(link, "here"). _(" to continue to an Application Master web interface owned by ", user). _(). _(); }
/** * Fetch the application report from the RM. * * @param id the app ID * @return the application report * @throws IOException if the request to the RM fails * @throws YarnException if the request to the RM fails */ private FetchedAppReport getFetchedAppReport(ApplicationId id) throws IOException, YarnException { FetchedAppReport fetchedAppReport = getApplicationReport(id); if (fetchedAppReport != null) { if ((fetchedAppReport.getAppReportSource() != AppReportSource.RM) && (fetchedAppReport.getAppReportSource() != AppReportSource.AHS)) { throw new UnsupportedOperationException("Application report not " + "fetched from RM or history server."); } } return fetchedAppReport; }
boolean userWasWarned = false; boolean userApproved = Boolean.valueOf(userApprovedParamS); boolean securityEnabled = isSecurityEnabled(); final String remoteUser = req.getRemoteUser(); final String pathInfo = req.getPathInfo(); if(parts.length < 2) { LOG.warn("{} gave an invalid proxy path {}", remoteUser, pathInfo); notFound(resp, "Your path appears to be formatted incorrectly."); return; LOG.warn("{} attempting to access {} that is invalid", remoteUser, appId); notFound(resp, appId + " appears to be formatted incorrectly."); return; String cookieName = getCheckCookieName(id); Cookie[] cookies = req.getCookies(); if (cookies != null) { ApplicationReport applicationReport = null; try { fetchedAppReport = getApplicationReport(id); if (fetchedAppReport != null) { if (fetchedAppReport.getAppReportSource() != AppReportSource.RM && notFound(resp, "Application " + appId + " could not be found " + "in RM or history server"); return;
private static Cookie makeCheckCookie(ApplicationId id, boolean isSet) { Cookie c = new Cookie(getCheckCookieName(id),String.valueOf(isSet)); c.setPath(ProxyUriUtils.getPath(id)); c.setMaxAge(60 * 60 * 2); //2 hours in seconds return c; }
/** * Warn the user that the link may not be safe! * @param resp the http response * @param link the link to point to * @param user the user that owns the link. * @throws IOException on any error. */ private static void warnUserPage(HttpServletResponse resp, String link, String user, ApplicationId id) throws IOException { //Set the cookie when we warn which overrides the query parameter //This is so that if a user passes in the approved query parameter without //having first visited this page then this page will still be displayed resp.addCookie(makeCheckCookie(id, false)); resp.setContentType(MimeType.HTML); Page p = new Page(resp.getWriter()); p.html(). h1("WARNING: The following page may not be safe!"). h3(). _("click ").a(link, "here"). _(" to continue to an Application Master web interface owned by ", user). _(). _(); }
boolean userWasWarned = false; boolean userApproved = Boolean.valueOf(userApprovedParamS); boolean securityEnabled = isSecurityEnabled(); final String remoteUser = req.getRemoteUser(); final String pathInfo = req.getPathInfo(); if(parts.length < 2) { LOG.warn("{} gave an invalid proxy path {}", remoteUser, pathInfo); notFound(resp, "Your path appears to be formatted incorrectly."); return; LOG.warn("{} attempting to access {} that is invalid", remoteUser, appId); notFound(resp, appId + " appears to be formatted incorrectly."); return; String cookieName = getCheckCookieName(id); Cookie[] cookies = req.getCookies(); if (cookies != null) { ApplicationReport applicationReport = null; try { fetchedAppReport = getApplicationReport(id); if (fetchedAppReport != null) { if (fetchedAppReport.getAppReportSource() != AppReportSource.RM && notFound(resp, "Application " + appId + " could not be found " + "in RM or history server"); return;
private boolean isSecurityEnabled() { Boolean b = (Boolean) getServletContext() .getAttribute(WebAppProxy.IS_SECURITY_ENABLED_ATTRIBUTE); return b != null ? b : false; }
private static Cookie makeCheckCookie(ApplicationId id, boolean isSet) { Cookie c = new Cookie(getCheckCookieName(id),String.valueOf(isSet)); c.setPath(ProxyUriUtils.getPath(id)); c.setMaxAge(60 * 60 * 2); //2 hours in seconds return c; }
/** * Warn the user that the link may not be safe! * @param resp the http response * @param link the link to point to * @param user the user that owns the link. * @throws IOException on any error. */ private static void warnUserPage(HttpServletResponse resp, String link, String user, ApplicationId id) throws IOException { //Set the cookie when we warn which overrides the query parameter //This is so that if a user passes in the approved query parameter without //having first visited this page then this page will still be displayed resp.addCookie(makeCheckCookie(id, false)); resp.setContentType(MimeType.HTML); Page p = new Page(resp.getWriter()); p.html(). h1("WARNING: The following page may not be safe!"). h3(). __("click ").a(link, "here"). __(" to continue to an Application Master web interface owned by ", user). __(). __(); }
@Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { methodAction(req, resp, HTTP.GET); }
private String getProxyHost() throws IOException { return ((String) getServletContext() .getAttribute(WebAppProxy.PROXY_HOST_ATTRIBUTE)); }
private static Cookie makeCheckCookie(ApplicationId id, boolean isSet) { Cookie c = new Cookie(getCheckCookieName(id),String.valueOf(isSet)); c.setPath(ProxyUriUtils.getPath(id)); c.setMaxAge(60 * 60 * 2); //2 hours in seconds return c; }
/** * Warn the user that the link may not be safe! * @param resp the http response * @param link the link to point to * @param user the user that owns the link. * @throws IOException on any error. */ private static void warnUserPage(HttpServletResponse resp, String link, String user, ApplicationId id) throws IOException { //Set the cookie when we warn which overrides the query parameter //This is so that if a user passes in the approved query parameter without //having first visited this page then this page will still be displayed resp.addCookie(makeCheckCookie(id, false)); resp.setContentType(MimeType.HTML); Page p = new Page(resp.getWriter()); p.html(). h1("WARNING: The following page may not be safe!"). h3(). _("click ").a(link, "here"). _(" to continue to an Application Master web interface owned by ", user). _(). _(); }
@Override protected final void doPut(final HttpServletRequest req, final HttpServletResponse resp) throws ServletException, IOException { methodAction(req, resp, HTTP.PUT); }
private boolean isSecurityEnabled() { Boolean b = (Boolean) getServletContext() .getAttribute(WebAppProxy.IS_SECURITY_ENABLED_ATTRIBUTE); return b != null ? b : false; }