[Yanel-commits] rev 21293 -
public/yanel/trunk/src/core/java/org/wyona/yanel/servlet
michi at wyona.com
michi at wyona.com
Sun Dec 31 00:19:22 CET 2006
Author: michi
Date: 2006-12-31 00:19:19 +0100 (Sun, 31 Dec 2006)
New Revision: 21293
Modified:
public/yanel/trunk/src/core/java/org/wyona/yanel/servlet/YanelServlet.java
Log:
BASIC Authentication for ICS requests
Modified: public/yanel/trunk/src/core/java/org/wyona/yanel/servlet/YanelServlet.java
===================================================================
--- public/yanel/trunk/src/core/java/org/wyona/yanel/servlet/YanelServlet.java 2006-12-30 00:03:38 UTC (rev 21292)
+++ public/yanel/trunk/src/core/java/org/wyona/yanel/servlet/YanelServlet.java 2006-12-30 23:19:19 UTC (rev 21293)
@@ -775,7 +775,7 @@
*/
private HttpServletResponse doAuthorize(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
- Role role = null;
+ Role role = null;
// TODO: Replace hardcoded roles by mapping between roles amd query strings ...
String value = request.getParameter("yanel.resource.usecase");
@@ -890,18 +890,11 @@
// TODO: Shouldn't this be here instead at the beginning of service() ...?
//if(doAuthenticate(request, response) != null) return response;
- // HTTP Authorization/Authentication
-/*
- response.setHeader("WWW-Authenticate", "BASIC realm=\"yanel\"");
- response.sendError(response.SC_UNAUTHORIZED);
-*/
- // Custom Authorization/Authentication
- // ...
- // TODO: Check if this is a neutron request or just a common GET request
+ // Check if this is a neutron request, a Sunbird/Calendar request or just a common GET request
+ // Also see e-mail about recognizing a WebDAV request: http://lists.w3.org/Archives/Public/w3c-dist-auth/2006AprJun/0064.html
StringBuffer sb = new StringBuffer("");
String neutronVersions = request.getHeader("Neutron");
- // http://lists.w3.org/Archives/Public/w3c-dist-auth/2006AprJun/0064.html
String clientSupportedAuthScheme = request.getHeader("WWW-Authenticate");
Realm realm = map.getRealm(new Path(request.getServletPath()));
if (clientSupportedAuthScheme != null && clientSupportedAuthScheme.equals("Neutron-Auth")) {
@@ -931,6 +924,10 @@
response.setHeader("WWW-Authenticate", "NEUTRON-AUTH");
PrintWriter w = response.getWriter();
w.print(sb);
+ } else if (request.getRequestURI().endsWith(".ics")) {
+ log.warn("Somebody seems to ask for a Calendar (ICS) ...");
+ response.setHeader("WWW-Authenticate", "BASIC realm=\"" + realm.getName() + "\"");
+ response.sendError(response.SC_UNAUTHORIZED);
} else {
getXHTMLAuthenticationForm(request, response, realm, null);
}
@@ -1052,7 +1049,7 @@
}
/**
- *
+ * Authentication
*/
public HttpServletResponse doAuthenticate(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
More information about the Yanel-commits
mailing list