cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r929725 - /cxf/dosgi/trunk/samples/security_filter/src/main/java/org/apache/cxf/dosgi/samples/security/SampleSecurityFilter.java
Date Wed, 31 Mar 2010 21:39:01 GMT
Author: sergeyb
Date: Wed Mar 31 21:39:01 2010
New Revision: 929725

URL: http://svn.apache.org/viewvc?rev=929725&view=rev
Log:
adding a missing demo file

Added:
    cxf/dosgi/trunk/samples/security_filter/src/main/java/org/apache/cxf/dosgi/samples/security/SampleSecurityFilter.java
  (with props)

Added: cxf/dosgi/trunk/samples/security_filter/src/main/java/org/apache/cxf/dosgi/samples/security/SampleSecurityFilter.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/samples/security_filter/src/main/java/org/apache/cxf/dosgi/samples/security/SampleSecurityFilter.java?rev=929725&view=auto
==============================================================================
--- cxf/dosgi/trunk/samples/security_filter/src/main/java/org/apache/cxf/dosgi/samples/security/SampleSecurityFilter.java
(added)
+++ cxf/dosgi/trunk/samples/security_filter/src/main/java/org/apache/cxf/dosgi/samples/security/SampleSecurityFilter.java
Wed Mar 31 21:39:01 2010
@@ -0,0 +1,57 @@
+/** 
+ * Licensed to the Apache Software Foundation (ASF) under one 
+ * or more contributor license agreements. See the NOTICE file 
+ * distributed with this work for additional information 
+ * regarding copyright ownership. The ASF licenses this file 
+ * to you under the Apache License, Version 2.0 (the 
+ * "License"); you may not use this file except in compliance 
+ * with the License. You may obtain a copy of the License at 
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0 
+ * 
+ * Unless required by applicable law or agreed to in writing, 
+ * software distributed under the License is distributed on an 
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 
+ * KIND, either express or implied. See the License for the 
+ * specific language governing permissions and limitations 
+ * under the License. 
+ */
+package org.apache.cxf.dosgi.samples.security;
+
+import java.io.IOException;
+import java.util.logging.Logger;
+
+import javax.servlet.Filter;
+import javax.servlet.FilterChain;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * A filter that requires a query string of "secure" to invoke the protected resource.
+ */
+public class SampleSecurityFilter implements Filter {
+  private static final Logger LOG = Logger.getLogger(SampleSecurityFilter.class.getName());
+
+  public void destroy() {
+    LOG.info("destroy()");
+  }
+
+  public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
throws IOException,
+          ServletException {
+    if("secure".equals(((HttpServletRequest)request).getQueryString())) {
+      LOG.info("Access granted");
+      chain.doFilter(request, response);
+    } else {
+      LOG.warning("Access denied");
+      ((HttpServletResponse)response).sendError(HttpServletResponse.SC_FORBIDDEN);
+    }
+  }
+
+  public void init(FilterConfig config) throws ServletException {
+    LOG.info("init()");
+  }
+}

Propchange: cxf/dosgi/trunk/samples/security_filter/src/main/java/org/apache/cxf/dosgi/samples/security/SampleSecurityFilter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/dosgi/trunk/samples/security_filter/src/main/java/org/apache/cxf/dosgi/samples/security/SampleSecurityFilter.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date



Mime
View raw message