perfsonar-dev - [GEANT/SA2/ps-java-services] r5648 - trunk/perfsonar-java-base2/src/main/java/org/perfsonar/base2/servlets
Subject: perfsonar development work
List archive
[GEANT/SA2/ps-java-services] r5648 - trunk/perfsonar-java-base2/src/main/java/org/perfsonar/base2/servlets
Chronological Thread
- From:
- To:
- Subject: [GEANT/SA2/ps-java-services] r5648 - trunk/perfsonar-java-base2/src/main/java/org/perfsonar/base2/servlets
- Date: Mon, 17 May 2010 13:32:38 +0100
Author: psnc.trzaszczka
Date: 2010-05-17 13:32:38 +0100 (Mon, 17 May 2010)
New Revision: 5648
Modified:
trunk/perfsonar-java-base2/src/main/java/org/perfsonar/base2/servlets/AuthServlet.java
Log:
method signature changed - bug PSSERVICES-497
Modified:
trunk/perfsonar-java-base2/src/main/java/org/perfsonar/base2/servlets/AuthServlet.java
===================================================================
---
trunk/perfsonar-java-base2/src/main/java/org/perfsonar/base2/servlets/AuthServlet.java
2010-05-14 14:10:43 UTC (rev 5647)
+++
trunk/perfsonar-java-base2/src/main/java/org/perfsonar/base2/servlets/AuthServlet.java
2010-05-17 12:32:38 UTC (rev 5648)
@@ -7,6 +7,7 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+import org.apache.log4j.Logger;
import org.perfsonar.base2.service.configuration.ConfigurationManager;
import org.perfsonar.base2.service.exceptions.PerfSONARException;
@@ -19,6 +20,8 @@
@SuppressWarnings("serial")
public abstract class AuthServlet extends HttpServlet {
+ private Logger logger=Logger.getLogger(AuthServlet.class);
+
private String username;
private String password;
@@ -50,12 +53,11 @@
* @param resp
*/
protected abstract void processRequest(HttpServletRequest req,
- HttpServletResponse resp);
+ HttpServletResponse resp) throws PerfSONARException;
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
-
String auth = req.getHeader("Authorization");
String[] credentials = receiveCredentials(auth);
if (credentials == null) {
@@ -64,7 +66,13 @@
} else {
username = credentials[0];
password = credentials[1];
- processRequest(req, resp);
+ try {
+ processRequest(req, resp);
+ } catch (PerfSONARException e) {
+ logger.warn(e);
+ resp.setHeader("WWW-Authenticate", "BASIC
realm=\"users\"");
+
resp.sendError(HttpServletResponse.SC_UNAUTHORIZED);
+ }
}
}
- [GEANT/SA2/ps-java-services] r5648 - trunk/perfsonar-java-base2/src/main/java/org/perfsonar/base2/servlets, svn-noreply, 05/17/2010
Archive powered by MHonArc 2.6.16.