ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [3/5] incubator-ignite git commit: #ignite-189: move GridSecuritySubjectAdapter to org.gridgain.grid.authentication.
Date Fri, 13 Feb 2015 08:50:24 GMT
#ignite-189: move GridSecuritySubjectAdapter to org.gridgain.grid.authentication.


Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/d169d960
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/d169d960
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/d169d960

Branch: refs/heads/ignite-189
Commit: d169d9601aeb8d69a43f90e6d5f55498e3762fbc
Parents: 85c5b69
Author: ivasilinets <ivasilinets@gridgain.com>
Authored: Fri Feb 13 11:14:42 2015 +0300
Committer: ivasilinets <ivasilinets@gridgain.com>
Committed: Fri Feb 13 11:14:42 2015 +0300

----------------------------------------------------------------------
 .../security/GridSecuritySubjectAdapter.java    | 131 -------------------
 .../security/os/GridOsSecurityProcessor.java    |  94 +++++++++++++
 .../optimized/optimized-classnames.properties   |   1 -
 .../discovery/AbstractDiscoverySelfTest.java    |   5 +-
 .../tcp/TcpDiscoverySpiStartStopSelfTest.java   |   5 +-
 .../junits/spi/GridSpiAbstractTest.java         |  40 +++++-
 6 files changed, 131 insertions(+), 145 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d169d960/modules/core/src/main/java/org/apache/ignite/internal/processors/security/GridSecuritySubjectAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/security/GridSecuritySubjectAdapter.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/security/GridSecuritySubjectAdapter.java
deleted file mode 100644
index 0c1edaf..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/security/GridSecuritySubjectAdapter.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * 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.ignite.internal.processors.security;
-
-import org.apache.ignite.internal.util.tostring.*;
-import org.apache.ignite.internal.util.typedef.internal.*;
-import org.apache.ignite.plugin.security.*;
-
-import java.net.*;
-import java.util.*;
-
-/**
- * Authenticated security subject.
- */
-public class GridSecuritySubjectAdapter implements GridSecuritySubject {
-    /** */
-    private static final long serialVersionUID = 0L;
-
-    /** Subject ID. */
-    private UUID id;
-
-    /** Subject type. */
-    private GridSecuritySubjectType subjType;
-
-    /** Address. */
-    private InetSocketAddress addr;
-
-    /** Permissions assigned to a subject. */
-    private GridSecurityPermissionSet permissions;
-
-    /** Login. */
-    @GridToStringInclude
-    private Object login;
-
-    /**
-     * @param subjType Subject type.
-     * @param id Subject ID.
-     */
-    public GridSecuritySubjectAdapter(GridSecuritySubjectType subjType, UUID id) {
-        this.subjType = subjType;
-        this.id = id;
-    }
-
-    /**
-     * Gets subject ID.
-     *
-     * @return Subject ID.
-     */
-    @Override public UUID id() {
-        return id;
-    }
-
-    /**
-     * Gets subject type.
-     *
-     * @return Subject type.
-     */
-    @Override public GridSecuritySubjectType type() {
-        return subjType;
-    }
-
-    /**
-     * Gets subject address.
-     *
-     * @return Subject address.
-     */
-    @Override public InetSocketAddress address() {
-        return addr;
-    }
-
-    /**
-     * Sets subject address.
-     *
-     * @param addr Subject address.
-     */
-    public void address(InetSocketAddress addr) {
-        this.addr = addr;
-    }
-
-    /**
-     * Gets security permissions.
-     *
-     * @return Security permissions.
-     */
-    @Override public GridSecurityPermissionSet permissions() {
-        return permissions;
-    }
-
-    /** {@inheritDoc} */
-    @Override public Object login() {
-        return login;
-    }
-
-    /**
-     * Sets login provided by security credentials.
-     *
-     * @param login Login.
-     */
-    public void login(Object login) {
-        this.login = login;
-    }
-
-    /**
-     * Sets security permissions.
-     *
-     * @param permissions Permissions.
-     */
-    public void permissions(GridSecurityPermissionSet permissions) {
-        this.permissions = permissions;
-    }
-
-    /** {@inheritDoc} */
-    public String toString() {
-        return S.toString(GridSecuritySubjectAdapter.class, this);
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d169d960/modules/core/src/main/java/org/apache/ignite/internal/processors/security/os/GridOsSecurityProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/security/os/GridOsSecurityProcessor.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/security/os/GridOsSecurityProcessor.java
index dafe907..3a82bb1 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/security/os/GridOsSecurityProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/security/os/GridOsSecurityProcessor.java
@@ -22,7 +22,9 @@ import org.apache.ignite.cluster.*;
 import org.apache.ignite.internal.*;
 import org.apache.ignite.internal.processors.*;
 import org.apache.ignite.internal.processors.security.*;
+import org.apache.ignite.internal.util.tostring.*;
 import org.apache.ignite.internal.util.typedef.*;
+import org.apache.ignite.internal.util.typedef.internal.*;
 import org.apache.ignite.plugin.security.*;
 import org.jetbrains.annotations.*;
 
@@ -121,4 +123,96 @@ public class GridOsSecurityProcessor extends GridNoopProcessorAdapter
implements
     @Override public boolean enabled() {
         return false;
     }
+
+     /**
+     * Authenticated security subject.
+     */
+     private class GridSecuritySubjectAdapter implements GridSecuritySubject {
+        /** */
+        private static final long serialVersionUID = 0L;
+
+        /** Subject ID. */
+        private UUID id;
+
+        /** Subject type. */
+        private GridSecuritySubjectType subjType;
+
+        /** Address. */
+        private InetSocketAddress addr;
+
+        /** Permissions assigned to a subject. */
+        private GridSecurityPermissionSet permissions;
+
+        /** Login. */
+        @GridToStringInclude
+        private Object login;
+
+        /**
+         * @param subjType Subject type.
+         * @param id Subject ID.
+         */
+        public GridSecuritySubjectAdapter(GridSecuritySubjectType subjType, UUID id) {
+            this.subjType = subjType;
+            this.id = id;
+        }
+
+        /**
+         * @return Subject ID.
+         */
+        @Override public UUID id() {
+            return id;
+        }
+
+        /**
+         * @return Subject type.
+         */
+        @Override public GridSecuritySubjectType type() {
+            return subjType;
+        }
+
+        /**
+         * @return Subject address.
+         */
+        @Override public InetSocketAddress address() {
+            return addr;
+        }
+
+        /**
+         * @param addr Subject address.
+         */
+        public void address(InetSocketAddress addr) {
+            this.addr = addr;
+        }
+
+        /**
+         * @return Security permissions.
+         */
+        @Override public GridSecurityPermissionSet permissions() {
+            return permissions;
+        }
+
+        /** {@inheritDoc} */
+        @Override public Object login() {
+            return login;
+        }
+
+        /**
+         * @param login Login.
+         */
+        public void login(Object login) {
+            this.login = login;
+        }
+
+        /**
+         * @param permissions Permissions.
+         */
+        public void permissions(GridSecurityPermissionSet permissions) {
+            this.permissions = permissions;
+        }
+
+        /** {@inheritDoc} */
+        public String toString() {
+            return S.toString(GridSecuritySubjectAdapter.class, this);
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d169d960/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/optimized-classnames.properties
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/optimized-classnames.properties
b/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/optimized-classnames.properties
index 163b868..090bfb3 100644
--- a/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/optimized-classnames.properties
+++ b/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/optimized-classnames.properties
@@ -279,7 +279,6 @@ org.apache.ignite.internal.managers.loadbalancer.GridLoadBalancerManager$1
 org.apache.ignite.internal.managers.security.GridAllowAllPermissionSet
 org.apache.ignite.internal.processors.security.GridSecurityContext
 org.gridgain.grid.kernal.processors.security.GridSecurityImpl
-org.apache.ignite.internal.processors.security.GridSecuritySubjectAdapter
 org.apache.ignite.internal.processors.affinity.GridAffinityAssignment
 org.apache.ignite.internal.processors.affinity.GridAffinityAssignmentCache$AffinityReadyFuture
 org.apache.ignite.internal.processors.affinity.GridAffinityMessage

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d169d960/modules/core/src/test/java/org/apache/ignite/spi/discovery/AbstractDiscoverySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/discovery/AbstractDiscoverySelfTest.java
b/modules/core/src/test/java/org/apache/ignite/spi/discovery/AbstractDiscoverySelfTest.java
index 45faeaf..f3b1036 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/discovery/AbstractDiscoverySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/discovery/AbstractDiscoverySelfTest.java
@@ -391,10 +391,7 @@ public abstract class AbstractDiscoverySelfTest<T extends IgniteSpi>
extends Gri
 
                 spi.setAuthenticator(new DiscoverySpiNodeAuthenticator() {
                     @Override public GridSecurityContext authenticateNode(ClusterNode n,
GridSecurityCredentials cred) {
-                        GridSecuritySubjectAdapter subj = new GridSecuritySubjectAdapter(
-                            GridSecuritySubjectType.REMOTE_NODE, n.id());
-
-                        subj.permissions(getAllPermissionSet());
+                        GridSecuritySubject subj = getGridSecuritySubject(GridSecuritySubjectType.REMOTE_NODE,
n.id());
 
                         return new GridSecurityContext(subj);
                     }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d169d960/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpiStartStopSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpiStartStopSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpiStartStopSelfTest.java
index 4a06c10..c7ef480 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpiStartStopSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpiStartStopSelfTest.java
@@ -66,10 +66,7 @@ public class TcpDiscoverySpiStartStopSelfTest extends GridSpiStartStopAbstractTe
     public DiscoverySpiNodeAuthenticator getAuthenticator() {
         return new DiscoverySpiNodeAuthenticator() {
             @Override public GridSecurityContext authenticateNode(ClusterNode n, GridSecurityCredentials
cred) {
-                GridSecuritySubjectAdapter subj = new GridSecuritySubjectAdapter(
-                    GridSecuritySubjectType.REMOTE_NODE, n.id());
-
-                subj.permissions(getAllPermissionSet());
+                GridSecuritySubject subj = getGridSecuritySubject(GridSecuritySubjectType.REMOTE_NODE,
n.id());
 
                 return new GridSecurityContext(subj);
             }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d169d960/modules/core/src/test/java/org/apache/ignite/testframework/junits/spi/GridSpiAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/spi/GridSpiAbstractTest.java
b/modules/core/src/test/java/org/apache/ignite/testframework/junits/spi/GridSpiAbstractTest.java
index 55917ea..630d67d 100644
--- a/modules/core/src/test/java/org/apache/ignite/testframework/junits/spi/GridSpiAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/spi/GridSpiAbstractTest.java
@@ -38,6 +38,7 @@ import org.jetbrains.annotations.*;
 
 import java.io.*;
 import java.lang.reflect.*;
+import java.net.*;
 import java.util.*;
 import java.util.concurrent.*;
 
@@ -98,7 +99,7 @@ public abstract class GridSpiAbstractTest<T extends IgniteSpi> extends
GridAbstr
     /**
      * @return Allow all permission security set.
      */
-    protected GridSecurityPermissionSet getAllPermissionSet() {
+    private GridSecurityPermissionSet getAllPermissionSet() {
         return new GridSecurityPermissionSet() {
             /** Serial version uid. */
             private static final long serialVersionUID = 0L;
@@ -126,6 +127,38 @@ public abstract class GridSpiAbstractTest<T extends IgniteSpi>
extends GridAbstr
     }
 
     /**
+     * @return Grid allow all security subject.
+     */
+    protected GridSecuritySubject getGridSecuritySubject(final GridSecuritySubjectType type,
final UUID id) {
+        return new GridSecuritySubject() {
+            /** {@inheritDoc} */
+            @Override public UUID id() {
+                return id;
+            }
+
+            /** {@inheritDoc} */
+            @Override public GridSecuritySubjectType type() {
+                return type;
+            }
+
+            /** {@inheritDoc} */
+            @Override public Object login() {
+                return null;
+            }
+
+            /** {@inheritDoc} */
+            @Override public InetSocketAddress address() {
+                return null;
+            }
+
+            /** {@inheritDoc} */
+            @Override public GridSecurityPermissionSet permissions() {
+                return getAllPermissionSet();
+            }
+        };
+    }
+
+    /**
      * @throws Exception If failed.
      */
     private void resetTestData() throws Exception {
@@ -349,10 +382,7 @@ public abstract class GridSpiAbstractTest<T extends IgniteSpi>
extends GridAbstr
 
         discoSpi.setAuthenticator(new DiscoverySpiNodeAuthenticator() {
             @Override public GridSecurityContext authenticateNode(ClusterNode n, GridSecurityCredentials
cred) {
-                GridSecuritySubjectAdapter subj = new GridSecuritySubjectAdapter(
-                    GridSecuritySubjectType.REMOTE_NODE, n.id());
-
-                subj.permissions(getAllPermissionSet());
+                GridSecuritySubject subj = getGridSecuritySubject(GridSecuritySubjectType.REMOTE_NODE,
n.id());
 
                 return new GridSecurityContext(subj);
             }


Mime
View raw message