cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1325314 - /cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/security/JAASAuthenticationFilter.java
Date Thu, 12 Apr 2012 15:10:32 GMT
Author: sergeyb
Date: Thu Apr 12 15:10:31 2012
New Revision: 1325314

URL: http://svn.apache.org/viewvc?rev=1325314&view=rev
Log:
Updating JAASAuthenticationFilter to default to Basic WWW-Authenticate challenge

Modified:
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/security/JAASAuthenticationFilter.java

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/security/JAASAuthenticationFilter.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/security/JAASAuthenticationFilter.java?rev=1325314&r1=1325313&r2=1325314&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/security/JAASAuthenticationFilter.java
(original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/security/JAASAuthenticationFilter.java
Thu Apr 12 15:10:31 2012
@@ -116,19 +116,22 @@ public class JAASAuthenticationFilter im
         } else {
             ResponseBuilder builder = Response.status(Response.Status.UNAUTHORIZED);
             
+            StringBuilder sb = new StringBuilder();
+            
             List<String> authHeader = headers.getRequestHeader(HttpHeaders.AUTHORIZATION);
             if (authHeader.size() > 0) {
-                StringBuilder sb = new StringBuilder();
                 // should HttpHeadersImpl do it ?
                 String[] authValues = authHeader.get(0).split(" ");
                 if (authValues.length > 0) {
                     sb.append(authValues[0]);
-                    if (realmName != null) {
-                        sb.append(' ').append(realmName);
-                    }
-                    builder.header(HttpHeaders.WWW_AUTHENTICATE, sb.toString());
                 }
+            } else {
+                sb.append("Basic");
+            }
+            if (realmName != null) {
+                sb.append(' ').append(realmName);
             }
+            builder.header(HttpHeaders.WWW_AUTHENTICATE, sb.toString());
             
             return builder.build();
         }



Mime
View raw message