You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by co...@apache.org on 2020/10/20 10:08:58 UTC

[cxf] branch master updated: Minor optimisation

This is an automated email from the ASF dual-hosted git repository.

coheigea pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cxf.git


The following commit(s) were added to refs/heads/master by this push:
     new dc2f6af  Minor optimisation
dc2f6af is described below

commit dc2f6af9ad09888cafb350f95935e9ec6abf8aee
Author: Colm O hEigeartaigh <co...@apache.org>
AuthorDate: Tue Oct 20 11:08:31 2020 +0100

    Minor optimisation
---
 .../http/auth/WSDLGetAuthenticatorInterceptor.java | 24 +++++++++-------------
 1 file changed, 10 insertions(+), 14 deletions(-)

diff --git a/rt/transports/http/src/main/java/org/apache/cxf/transport/http/auth/WSDLGetAuthenticatorInterceptor.java b/rt/transports/http/src/main/java/org/apache/cxf/transport/http/auth/WSDLGetAuthenticatorInterceptor.java
index eb7a4ae..15fb780 100644
--- a/rt/transports/http/src/main/java/org/apache/cxf/transport/http/auth/WSDLGetAuthenticatorInterceptor.java
+++ b/rt/transports/http/src/main/java/org/apache/cxf/transport/http/auth/WSDLGetAuthenticatorInterceptor.java
@@ -62,25 +62,21 @@ public class WSDLGetAuthenticatorInterceptor extends AbstractPhaseInterceptor<Me
 
         String method = (String)message.get(Message.HTTP_REQUEST_METHOD);
         String query = (String)message.get(Message.QUERY_STRING);
-        if (!"GET".equals(method) || StringUtils.isEmpty(query)) {
+        if (!"GET".equals(method) || StringUtils.isEmpty(query) || StringUtils.isEmpty(contextName)) {
             return;
         }
         Endpoint endpoint = message.getExchange().getEndpoint();
         synchronized (endpoint) {
-            if (!StringUtils.isEmpty(contextName)) {
-                AuthorizationPolicy policy = message.get(AuthorizationPolicy.class);
-                if (policy == null) {
-                    handle401response(message, endpoint);
-                    return;
-                }
-                Subject subject = (Subject)authenticate(policy.getUserName(), policy.getPassword());
-                if (subject == null) {
-                    handle401response(message, endpoint);
-                    return;
-                }
-
+            AuthorizationPolicy policy = message.get(AuthorizationPolicy.class);
+            if (policy == null) {
+                handle401response(message, endpoint);
+                return;
+            }
+            Subject subject = (Subject) authenticate(policy.getUserName(), policy.getPassword());
+            if (subject == null) {
+                handle401response(message, endpoint);
+                return;
             }
-
         }
     }