qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rgodf...@apache.org
Subject svn commit: r1765979 - in /qpid/java/branches/transfer-queue: ./ broker-core/src/main/java/org/apache/qpid/server/model/ broker-core/src/main/java/org/apache/qpid/server/model/preferences/ broker-core/src/main/java/org/apache/qpid/server/security/auth/...
Date Fri, 21 Oct 2016 10:09:23 GMT
Author: rgodfrey
Date: Fri Oct 21 10:09:22 2016
New Revision: 1765979

URL: http://svn.apache.org/viewvc?rev=1765979&view=rev
Log:
merge up to r1763545 from trunk

Modified:
    qpid/java/branches/transfer-queue/   (props changed)
    qpid/java/branches/transfer-queue/broker-core/src/main/java/org/apache/qpid/server/model/AbstractConfiguredObject.java
    qpid/java/branches/transfer-queue/broker-core/src/main/java/org/apache/qpid/server/model/BrokerImpl.java
    qpid/java/branches/transfer-queue/broker-core/src/main/java/org/apache/qpid/server/model/preferences/GenericPrincipal.java
    qpid/java/branches/transfer-queue/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/oauth2/OAuth2UserPrincipal.java
    qpid/java/branches/transfer-queue/broker-core/src/main/java/org/apache/qpid/server/transport/AggregateTicker.java
    qpid/java/branches/transfer-queue/broker-core/src/main/java/org/apache/qpid/server/virtualhost/AbstractVirtualHost.java
    qpid/java/branches/transfer-queue/common/src/main/java/org/apache/qpid/codec/AMQDecoder.java
    qpid/java/branches/transfer-queue/common/src/main/java/org/apache/qpid/codec/ClientDecoder.java

Propchange: qpid/java/branches/transfer-queue/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Oct 21 10:09:22 2016
@@ -9,4 +9,5 @@
 /qpid/branches/java-broker-vhost-refactor/java:1493674-1494547
 /qpid/branches/java-network-refactor/qpid/java:805429-821809
 /qpid/branches/qpid-2935/qpid/java:1061302-1072333
+/qpid/java/trunk:1763546-1763622
 /qpid/trunk/qpid:796646-796653

Modified: qpid/java/branches/transfer-queue/broker-core/src/main/java/org/apache/qpid/server/model/AbstractConfiguredObject.java
URL: http://svn.apache.org/viewvc/qpid/java/branches/transfer-queue/broker-core/src/main/java/org/apache/qpid/server/model/AbstractConfiguredObject.java?rev=1765979&r1=1765978&r2=1765979&view=diff
==============================================================================
--- qpid/java/branches/transfer-queue/broker-core/src/main/java/org/apache/qpid/server/model/AbstractConfiguredObject.java
(original)
+++ qpid/java/branches/transfer-queue/broker-core/src/main/java/org/apache/qpid/server/model/AbstractConfiguredObject.java
Fri Oct 21 10:09:22 2016
@@ -2994,7 +2994,7 @@ public abstract class AbstractConfigured
         return isSystemSubject(subject);
     }
 
-    private boolean isSystemSubject(final Subject subject)
+    protected boolean isSystemSubject(final Subject subject)
     {
         return subject != null  && subject.getPrincipals().contains(getSystemPrincipal());
     }

Modified: qpid/java/branches/transfer-queue/broker-core/src/main/java/org/apache/qpid/server/model/BrokerImpl.java
URL: http://svn.apache.org/viewvc/qpid/java/branches/transfer-queue/broker-core/src/main/java/org/apache/qpid/server/model/BrokerImpl.java?rev=1765979&r1=1765978&r2=1765979&view=diff
==============================================================================
--- qpid/java/branches/transfer-queue/broker-core/src/main/java/org/apache/qpid/server/model/BrokerImpl.java
(original)
+++ qpid/java/branches/transfer-queue/broker-core/src/main/java/org/apache/qpid/server/model/BrokerImpl.java
Fri Oct 21 10:09:22 2016
@@ -68,8 +68,8 @@ import org.apache.qpid.server.plugin.Sys
 import org.apache.qpid.server.security.AccessControl;
 import org.apache.qpid.server.security.CompoundAccessControl;
 import org.apache.qpid.server.security.Result;
-import org.apache.qpid.server.security.SecurityToken;
-import org.apache.qpid.server.security.access.Operation;
+import org.apache.qpid.server.security.SubjectFixedResultAccessControl;
+import org.apache.qpid.server.security.SubjectFixedResultAccessControl.ResultCalculator;
 import org.apache.qpid.server.security.auth.AuthenticatedPrincipal;
 import org.apache.qpid.server.security.auth.UsernamePrincipal;
 import org.apache.qpid.server.security.auth.manager.SimpleAuthenticationManager;
@@ -97,44 +97,14 @@ public class BrokerImpl extends Abstract
 
     public static final String MANAGEMENT_MODE_AUTHENTICATION = "MANAGEMENT_MODE_AUTHENTICATION";
 
-    private final AccessControl<SecurityToken> _systemUserAllowed = new AccessControl<SecurityToken>()
+    private final AccessControl _systemUserAllowed = new SubjectFixedResultAccessControl(new
ResultCalculator()
     {
         @Override
-        public Result getDefault()
+        public Result getResult(final Subject subject)
         {
-            return Result.DEFER;
+            return isSystemSubject(subject) ? Result.ALLOWED : Result.DEFER;
         }
-
-        @Override
-        public SecurityToken newToken()
-        {
-            return null;
-        }
-
-        @Override
-        public SecurityToken newToken(final Subject subject)
-        {
-            return null;
-        }
-
-        @Override
-        public Result authorise(final SecurityToken token,
-                                final Operation operation,
-                                final PermissionedObject configuredObject)
-        {
-            return isSystemProcess() ? Result.ALLOWED : Result.DEFER;
-        }
-
-        @Override
-        public Result authorise(final SecurityToken token,
-                                final Operation operation,
-                                final PermissionedObject configuredObject,
-                                final Map<String, Object> arguments)
-        {
-            return isSystemProcess() ? Result.ALLOWED : Result.DEFER;
-        }
-    };
-
+    }, Result.DEFER);
 
     private final BrokerPrincipal _principal;
 

Modified: qpid/java/branches/transfer-queue/broker-core/src/main/java/org/apache/qpid/server/model/preferences/GenericPrincipal.java
URL: http://svn.apache.org/viewvc/qpid/java/branches/transfer-queue/broker-core/src/main/java/org/apache/qpid/server/model/preferences/GenericPrincipal.java?rev=1765979&r1=1765978&r2=1765979&view=diff
==============================================================================
--- qpid/java/branches/transfer-queue/broker-core/src/main/java/org/apache/qpid/server/model/preferences/GenericPrincipal.java
(original)
+++ qpid/java/branches/transfer-queue/broker-core/src/main/java/org/apache/qpid/server/model/preferences/GenericPrincipal.java
Fri Oct 21 10:09:22 2016
@@ -28,6 +28,7 @@ import java.util.Collection;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
+import org.apache.qpid.server.model.ConfiguredObject;
 import org.apache.qpid.server.security.QpidPrincipal;
 
 public class GenericPrincipal implements Principal
@@ -42,8 +43,17 @@ public class GenericPrincipal implements
     public GenericPrincipal(final QpidPrincipal principal)
     {
         _name = principal.getName();
-        _originType = principal.getOrigin().getType();
-        _originName = principal.getOrigin().getName();
+        ConfiguredObject<?> origin = principal.getOrigin();
+        if (origin != null)
+        {
+            _originType = origin.getType();
+            _originName = origin.getName();
+        }
+        else
+        {
+            _originType = "UNKNOWN";
+            _originName = "";
+        }
     }
 
     public GenericPrincipal(final String name)

Modified: qpid/java/branches/transfer-queue/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/oauth2/OAuth2UserPrincipal.java
URL: http://svn.apache.org/viewvc/qpid/java/branches/transfer-queue/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/oauth2/OAuth2UserPrincipal.java?rev=1765979&r1=1765978&r2=1765979&view=diff
==============================================================================
--- qpid/java/branches/transfer-queue/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/oauth2/OAuth2UserPrincipal.java
(original)
+++ qpid/java/branches/transfer-queue/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/oauth2/OAuth2UserPrincipal.java
Fri Oct 21 10:09:22 2016
@@ -20,12 +20,12 @@
  */
 package org.apache.qpid.server.security.auth.manager.oauth2;
 
-import java.security.Principal;
-
 import org.apache.qpid.server.model.AuthenticationProvider;
+import org.apache.qpid.server.model.ConfiguredObject;
+import org.apache.qpid.server.security.QpidPrincipal;
 
 
-public class OAuth2UserPrincipal implements Principal
+public class OAuth2UserPrincipal implements QpidPrincipal
 {
     private final String _accessToken;
     private final String _name;
@@ -58,6 +58,12 @@ public class OAuth2UserPrincipal impleme
     }
 
     @Override
+    public ConfiguredObject<?> getOrigin()
+    {
+        return _authenticationProvider;
+    }
+
+    @Override
     public boolean equals(final Object o)
     {
         if (this == o)

Modified: qpid/java/branches/transfer-queue/broker-core/src/main/java/org/apache/qpid/server/transport/AggregateTicker.java
URL: http://svn.apache.org/viewvc/qpid/java/branches/transfer-queue/broker-core/src/main/java/org/apache/qpid/server/transport/AggregateTicker.java?rev=1765979&r1=1765978&r2=1765979&view=diff
==============================================================================
--- qpid/java/branches/transfer-queue/broker-core/src/main/java/org/apache/qpid/server/transport/AggregateTicker.java
(original)
+++ qpid/java/branches/transfer-queue/broker-core/src/main/java/org/apache/qpid/server/transport/AggregateTicker.java
Fri Oct 21 10:09:22 2016
@@ -32,9 +32,12 @@ public class AggregateTicker implements
     public int getTimeToNextTick(final long currentTime)
     {
         int nextTick = Integer.MAX_VALUE;
-        for(Ticker ticker : _tickers)
+        if (!_tickers.isEmpty())
         {
-            nextTick = Math.min(ticker.getTimeToNextTick(currentTime), nextTick);
+            for (Ticker ticker : _tickers)
+            {
+                nextTick = Math.min(ticker.getTimeToNextTick(currentTime), nextTick);
+            }
         }
         return nextTick;
     }
@@ -68,11 +71,14 @@ public class AggregateTicker implements
     @Override
     public void notifySchedulingDelay(final long schedulingDelay)
     {
-        for (Ticker ticker : _tickers)
+        if (!_tickers.isEmpty())
         {
-            if (ticker instanceof SchedulingDelayNotificationListener)
+            for (Ticker ticker : _tickers)
             {
-                ((SchedulingDelayNotificationListener) ticker).notifySchedulingDelay(schedulingDelay);
+                if (ticker instanceof SchedulingDelayNotificationListener)
+                {
+                    ((SchedulingDelayNotificationListener) ticker).notifySchedulingDelay(schedulingDelay);
+                }
             }
         }
     }

Modified: qpid/java/branches/transfer-queue/broker-core/src/main/java/org/apache/qpid/server/virtualhost/AbstractVirtualHost.java
URL: http://svn.apache.org/viewvc/qpid/java/branches/transfer-queue/broker-core/src/main/java/org/apache/qpid/server/virtualhost/AbstractVirtualHost.java?rev=1765979&r1=1765978&r2=1765979&view=diff
==============================================================================
--- qpid/java/branches/transfer-queue/broker-core/src/main/java/org/apache/qpid/server/virtualhost/AbstractVirtualHost.java
(original)
+++ qpid/java/branches/transfer-queue/broker-core/src/main/java/org/apache/qpid/server/virtualhost/AbstractVirtualHost.java
Fri Oct 21 10:09:22 2016
@@ -108,7 +108,8 @@ import org.apache.qpid.server.queue.Queu
 import org.apache.qpid.server.security.AccessControl;
 import org.apache.qpid.server.security.CompoundAccessControl;
 import org.apache.qpid.server.security.Result;
-import org.apache.qpid.server.security.SecurityToken;
+import org.apache.qpid.server.security.SubjectFixedResultAccessControl;
+import org.apache.qpid.server.security.SubjectFixedResultAccessControl.ResultCalculator;
 import org.apache.qpid.server.security.access.Operation;
 import org.apache.qpid.server.security.auth.AuthenticatedPrincipal;
 import org.apache.qpid.server.stats.StatisticsCounter;
@@ -214,45 +215,14 @@ public abstract class AbstractVirtualHos
 
     private volatile boolean _createDefaultExchanges;
 
-
-    private final AccessControl<SecurityToken> _systemUserAllowed = new AccessControl<SecurityToken>()
+    private final AccessControl _systemUserAllowed = new SubjectFixedResultAccessControl(new
ResultCalculator()
     {
         @Override
-        public Result getDefault()
-        {
-            return Result.DEFER;
-        }
-
-        @Override
-        public SecurityToken newToken()
-        {
-            return null;
-        }
-
-        @Override
-        public SecurityToken newToken(final Subject subject)
+        public Result getResult(final Subject subject)
         {
-            return null;
+            return isSystemSubject(subject) ? Result.ALLOWED : Result.DEFER;
         }
-
-        @Override
-        public Result authorise(final SecurityToken token,
-                                final Operation operation,
-                                final PermissionedObject configuredObject)
-        {
-            return isSystemProcess() ? Result.ALLOWED : Result.DEFER;
-        }
-
-        @Override
-        public Result authorise(final SecurityToken token,
-                                final Operation operation,
-                                final PermissionedObject configuredObject,
-                                final Map<String, Object> arguments)
-        {
-            return isSystemProcess() ? Result.ALLOWED : Result.DEFER;
-        }
-    };
-
+    }, Result.DEFER);
 
     @ManagedAttributeField
     private boolean _queue_deadLetterQueueEnabled;

Modified: qpid/java/branches/transfer-queue/common/src/main/java/org/apache/qpid/codec/AMQDecoder.java
URL: http://svn.apache.org/viewvc/qpid/java/branches/transfer-queue/common/src/main/java/org/apache/qpid/codec/AMQDecoder.java?rev=1765979&r1=1765978&r2=1765979&view=diff
==============================================================================
--- qpid/java/branches/transfer-queue/common/src/main/java/org/apache/qpid/codec/AMQDecoder.java
(original)
+++ qpid/java/branches/transfer-queue/common/src/main/java/org/apache/qpid/codec/AMQDecoder.java
Fri Oct 21 10:09:22 2016
@@ -124,7 +124,7 @@ public abstract class AMQDecoder<T exten
 
             }
         }
-        return required;
+        return buf.hasRemaining() ? required : 0;
     }
 
 

Modified: qpid/java/branches/transfer-queue/common/src/main/java/org/apache/qpid/codec/ClientDecoder.java
URL: http://svn.apache.org/viewvc/qpid/java/branches/transfer-queue/common/src/main/java/org/apache/qpid/codec/ClientDecoder.java?rev=1765979&r1=1765978&r2=1765979&view=diff
==============================================================================
--- qpid/java/branches/transfer-queue/common/src/main/java/org/apache/qpid/codec/ClientDecoder.java
(original)
+++ qpid/java/branches/transfer-queue/common/src/main/java/org/apache/qpid/codec/ClientDecoder.java
Fri Oct 21 10:09:22 2016
@@ -39,62 +39,52 @@ public class ClientDecoder extends AMQDe
         super(false, methodProcessor);
     }
 
-    public void decodeBuffer(ByteBuffer buf)
-            throws AMQFrameDecodingException, AMQProtocolVersionException
+    public void decodeBuffer(ByteBuffer incomingBuffer) throws AMQFrameDecodingException,
AMQProtocolVersionException
     {
-
-        buf = buf.slice();
-
-        if(_incompleteBuffer != null)
+        if (_incompleteBuffer == null)
+        {
+            QpidByteBuffer qpidByteBuffer = QpidByteBuffer.wrap(incomingBuffer);
+            final int required = decode(qpidByteBuffer);
+            if (required != 0)
+            {
+                _incompleteBuffer = QpidByteBuffer.allocate(qpidByteBuffer.remaining() +
required);
+                _incompleteBuffer.put(qpidByteBuffer);
+            }
+            qpidByteBuffer.dispose();
+        }
+        else
         {
-            if(buf.remaining() < _incompleteBuffer.remaining())
+            if (incomingBuffer.remaining() < _incompleteBuffer.remaining())
             {
-                _incompleteBuffer.put(buf);
-                return;
+                _incompleteBuffer.put(incomingBuffer);
             }
             else
             {
-                final ByteBuffer start = buf.duplicate();
-                start.limit(_incompleteBuffer.remaining());
-                buf.position(buf.position()+_incompleteBuffer.remaining());
-                _incompleteBuffer.put(start);
                 _incompleteBuffer.flip();
-                final int required = decode(_incompleteBuffer);
+                final QpidByteBuffer aggregatedBuffer =
+                        QpidByteBuffer.allocate(_incompleteBuffer.remaining() + incomingBuffer.remaining());
+                aggregatedBuffer.put(_incompleteBuffer);
+                aggregatedBuffer.put(incomingBuffer);
+                aggregatedBuffer.flip();
+                final int required = decode(aggregatedBuffer);
 
-                if(required != 0)
+                _incompleteBuffer.dispose();
+                if (required != 0)
                 {
-                    QpidByteBuffer newBuffer = QpidByteBuffer.allocate(required + _incompleteBuffer.remaining());
-                    newBuffer.put(_incompleteBuffer);
-                    _incompleteBuffer.dispose();
-                    _incompleteBuffer = newBuffer;
-                    if(buf.hasRemaining())
-                    {
-                        decodeBuffer(buf);
-                    }
-                    return;
+                    _incompleteBuffer = QpidByteBuffer.allocate(aggregatedBuffer.remaining()
+ required);
+                    _incompleteBuffer.put(aggregatedBuffer);
                 }
                 else
                 {
-                    _incompleteBuffer.dispose();
                     _incompleteBuffer = null;
-                    if(!buf.hasRemaining())
-                    {
-                        return;
-                    }
                 }
+                aggregatedBuffer.dispose();
             }
         }
-
-        QpidByteBuffer qpidByteBuffer = QpidByteBuffer.wrap(buf);
-        final int required = decode(qpidByteBuffer);
-        if(required != 0)
-        {
-            _incompleteBuffer = QpidByteBuffer.allocate(qpidByteBuffer.remaining()+required);
-            _incompleteBuffer.put(qpidByteBuffer);
-        }
-
+        // post-condition: assert(!incomingBuffer.hasRemaining());
     }
 
+    @Override
     void processMethod(int channelId,
                        QpidByteBuffer in)
             throws AMQFrameDecodingException



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message