directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kayyag...@apache.org
Subject svn commit: r1541203 - in /directory/escimo/trunk/server/src/main/java/org/apache/directory/scim/rest: SchemaService.java auth/AuthenticationFilter.java
Date Tue, 12 Nov 2013 19:26:20 GMT
Author: kayyagari
Date: Tue Nov 12 19:26:19 2013
New Revision: 1541203

URL: http://svn.apache.org/r1541203
Log:
o bypass the /Schemas URI
o send standard error

Modified:
    directory/escimo/trunk/server/src/main/java/org/apache/directory/scim/rest/SchemaService.java
    directory/escimo/trunk/server/src/main/java/org/apache/directory/scim/rest/auth/AuthenticationFilter.java

Modified: directory/escimo/trunk/server/src/main/java/org/apache/directory/scim/rest/SchemaService.java
URL: http://svn.apache.org/viewvc/directory/escimo/trunk/server/src/main/java/org/apache/directory/scim/rest/SchemaService.java?rev=1541203&r1=1541202&r2=1541203&view=diff
==============================================================================
--- directory/escimo/trunk/server/src/main/java/org/apache/directory/scim/rest/SchemaService.java
(original)
+++ directory/escimo/trunk/server/src/main/java/org/apache/directory/scim/rest/SchemaService.java
Tue Nov 12 19:26:19 2013
@@ -30,6 +30,10 @@ import javax.ws.rs.core.Response.Respons
 import javax.ws.rs.core.UriInfo;
 
 import org.apache.directory.scim.ProviderService;
+import org.apache.directory.scim.json.ResourceSerializer;
+import org.apache.directory.scim.schema.ErrorCode;
+import org.apache.directory.scim.schema.ErrorResponse;
+import org.apache.directory.scim.schema.ErrorResponse.ScimError;
 import org.apache.directory.scim.schema.JsonSchema;
 
 /**
@@ -59,7 +63,11 @@ public class SchemaService
         }
         else
         {
-            rb = Response.status( Response.Status.NOT_FOUND ).entity( "No schema found with
the URI " + schemaUri );
+            ScimError err = new ScimError( ErrorCode.NOT_FOUND, "No schema found with the
URI " + schemaUri );
+            
+            ErrorResponse resp = new ErrorResponse( err );
+            String json = ResourceSerializer.serialize( resp );
+            rb = Response.status( err.getCode() ).entity( json );
         }
         
         return rb.build();

Modified: directory/escimo/trunk/server/src/main/java/org/apache/directory/scim/rest/auth/AuthenticationFilter.java
URL: http://svn.apache.org/viewvc/directory/escimo/trunk/server/src/main/java/org/apache/directory/scim/rest/auth/AuthenticationFilter.java?rev=1541203&r1=1541202&r2=1541203&view=diff
==============================================================================
--- directory/escimo/trunk/server/src/main/java/org/apache/directory/scim/rest/auth/AuthenticationFilter.java
(original)
+++ directory/escimo/trunk/server/src/main/java/org/apache/directory/scim/rest/auth/AuthenticationFilter.java
Tue Nov 12 19:26:19 2013
@@ -70,6 +70,13 @@ public class AuthenticationFilter implem
         
         HttpServletRequest httpReq = ( HttpServletRequest ) req;
         HttpServletResponse httpResp = ( HttpServletResponse ) resp;
+
+        // /Schemas serves read-only resources
+        if( httpReq.getRequestURI().contains( "/Schemas" ) )
+        {
+            chain.doFilter( req, resp );
+            return;
+        }
         
         String userHeader = httpReq.getHeader( RequestContext.USER_AUTH_HEADER );
         



Mime
View raw message