Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 361365 | Differences between
and this patch

Collapse All | Expand All

(-)a/bundles/org.eclipse.orion.server.authentication.form/src/org/eclipse/orion/server/authentication/form/FormAuthenticationService.java (-5 / +1 lines)
Lines 90-100 public class FormAuthenticationService implements IAuthenticationService { Link Here
90
		String xRequestedWith = req.getHeader("X-Requested-With"); //$NON-NLS-1$
90
		String xRequestedWith = req.getHeader("X-Requested-With"); //$NON-NLS-1$
91
91
92
		if (version == null && !"XMLHttpRequest".equals(xRequestedWith)) { //$NON-NLS-1$
92
		if (version == null && !"XMLHttpRequest".equals(xRequestedWith)) { //$NON-NLS-1$
93
			try {
93
			resp.sendRedirect(req.getContextPath() + "/loginstatic/LoginWindow.html?redirect=" + req.getRequestURL());
94
				req.getRequestDispatcher("/loginstatic/LoginWindow.html").forward(req, resp);
95
			} catch (ServletException e) {
96
				LogHelper.log(new Status(IStatus.ERROR, Activator.PI_FORM_SERVLETS, 1, "An error occured during authenitcation", e));
97
			}
98
		} else {
94
		} else {
99
			resp.setContentType("application/json; charset=UTF-8");
95
			resp.setContentType("application/json; charset=UTF-8");
100
			JSONObject result = new JSONObject();
96
			JSONObject result = new JSONObject();
(-)a/bundles/org.eclipse.orion.server.authentication.form/src/org/eclipse/orion/server/authentication/form/servlets/LoginServlet.java (-2 / +1 lines)
Lines 101-108 public class LoginServlet extends HttpServlet { Link Here
101
101
102
				if (version == null && !"XMLHttpRequest".equals(xRequestedWith)) { //$NON-NLS-1$
102
				if (version == null && !"XMLHttpRequest".equals(xRequestedWith)) { //$NON-NLS-1$
103
					//RequestDispatcher rd = req.getRequestDispatcher("/loginform?error=" + new String(Base64.encode(invalidLoginError.getBytes()))); //$NON-NLS-1$
103
					//RequestDispatcher rd = req.getRequestDispatcher("/loginform?error=" + new String(Base64.encode(invalidLoginError.getBytes()))); //$NON-NLS-1$
104
					RequestDispatcher rd = req.getRequestDispatcher("/loginstatic/LoginWindow.html");
104
					resp.sendRedirect(req.getContextPath() + "/loginstatic/LoginWindow.html");
105
					rd.include(req, resp);
106
				} else {
105
				} else {
107
					resp.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
106
					resp.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
108
					PrintWriter writer = resp.getWriter();
107
					PrintWriter writer = resp.getWriter();
(-)a/bundles/org.eclipse.orion.server.authentication.formopenid/src/org/eclipse/orion/server/authentication/formopenid/FormOpenIdAuthenticationService.java (-7 / +3 lines)
Lines 79-85 public class FormOpenIdAuthenticationService implements IAuthenticationService { Link Here
79
79
80
	private void setNotAuthenticated(HttpServletRequest req, HttpServletResponse resp, Properties properties) throws IOException {
80
	private void setNotAuthenticated(HttpServletRequest req, HttpServletResponse resp, Properties properties) throws IOException {
81
		resp.setHeader("WWW-Authenticate", HttpServletRequest.FORM_AUTH); //$NON-NLS-1$
81
		resp.setHeader("WWW-Authenticate", HttpServletRequest.FORM_AUTH); //$NON-NLS-1$
82
		resp.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
82
		resp.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
83
83
84
		// redirection from FormAuthenticationService.setNotAuthenticated
84
		// redirection from FormAuthenticationService.setNotAuthenticated
85
		String versionString = req.getHeader("Orion-Version"); //$NON-NLS-1$
85
		String versionString = req.getHeader("Orion-Version"); //$NON-NLS-1$
Lines 90-100 public class FormOpenIdAuthenticationService implements IAuthenticationService { Link Here
90
		String xRequestedWith = req.getHeader("X-Requested-With"); //$NON-NLS-1$
90
		String xRequestedWith = req.getHeader("X-Requested-With"); //$NON-NLS-1$
91
91
92
		if (version == null && !"XMLHttpRequest".equals(xRequestedWith)) { //$NON-NLS-1$
92
		if (version == null && !"XMLHttpRequest".equals(xRequestedWith)) { //$NON-NLS-1$
93
			try {
93
			resp.sendRedirect(req.getContextPath() + "/mixloginstatic/LoginWindow.html?redirect=" + req.getRequestURL());
94
				req.getRequestDispatcher("/mixloginstatic/LoginWindow.html").forward(req, resp);
95
			} catch (ServletException e) {
96
				LogHelper.log(new Status(IStatus.ERROR, Activator.PI_FORMOPENID_SERVLETS, 1, "An error occured during authenitcation", e));
97
			}
98
		} else {
94
		} else {
99
			resp.setContentType(ProtocolConstants.CONTENT_TYPE_JSON);
95
			resp.setContentType(ProtocolConstants.CONTENT_TYPE_JSON);
100
			JSONObject result = new JSONObject();
96
			JSONObject result = new JSONObject();
Lines 104-110 public class FormOpenIdAuthenticationService implements IAuthenticationService { Link Here
104
			} catch (JSONException e) {
100
			} catch (JSONException e) {
105
				LogHelper.log(new Status(IStatus.ERROR, Activator.PI_FORMOPENID_SERVLETS, 1, "An error occured during authenitcation", e));
101
				LogHelper.log(new Status(IStatus.ERROR, Activator.PI_FORMOPENID_SERVLETS, 1, "An error occured during authenitcation", e));
106
			}
102
			}
107
			resp.getWriter().print(result.toString());
103
			resp.getWriter().print(result.toString());
108
		}
104
		}
109
	}
105
	}
110
106

Return to bug 361365