ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [37/50] incubator-ignite git commit: sp-3 renaming
Date Fri, 10 Apr 2015 13:07:16 GMT
 sp-3 renaming


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

Branch: refs/heads/ignite-gg-9998
Commit: 219a2ee9075e94aa56f9de7aea6606feaa3d5468
Parents: dbe0ac2
Author: Yakov Zhdanov <yzhdanov@gridgain.com>
Authored: Fri Apr 10 13:56:24 2015 +0300
Committer: Yakov Zhdanov <yzhdanov@gridgain.com>
Committed: Fri Apr 10 13:56:24 2015 +0300

----------------------------------------------------------------------
 .../client/GridClientConfiguration.java         |   8 +-
 .../GridClientConnectionManagerAdapter.java     |   2 +-
 .../discovery/GridDiscoveryManager.java         |   2 +-
 .../processors/rest/GridRestProcessor.java      |  12 +-
 .../security/GridSecurityProcessor.java         |   2 +-
 .../security/os/GridOsSecurityProcessor.java    |   2 +-
 .../plugin/security/AuthenticationContext.java  |   6 +-
 .../security/GridSecurityCredentials.java       | 184 ------------------
 .../GridSecurityCredentialsBasicProvider.java   |  44 -----
 .../GridSecurityCredentialsProvider.java        |   6 +-
 .../plugin/security/SecurityCredentials.java    | 191 +++++++++++++++++++
 .../SecurityCredentialsBasicProvider.java       |  44 +++++
 .../DiscoverySpiNodeAuthenticator.java          |   2 +-
 .../spi/discovery/tcp/TcpDiscoverySpi.java      |   8 +-
 .../http/jetty/GridJettyRestHandler.java        |   2 +-
 15 files changed, 261 insertions(+), 254 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/219a2ee9/modules/core/src/main/java/org/apache/ignite/internal/client/GridClientConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/client/GridClientConfiguration.java
b/modules/core/src/main/java/org/apache/ignite/internal/client/GridClientConfiguration.java
index cfd780c..1b2389a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/client/GridClientConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/client/GridClientConfiguration.java
@@ -674,12 +674,12 @@ public class GridClientConfiguration {
             int idx = cred.indexOf(':');
 
             if (idx >= 0 && idx < cred.length() - 1) {
-                setSecurityCredentialsProvider(new GridSecurityCredentialsBasicProvider(
-                    new GridSecurityCredentials(cred.substring(0, idx), cred.substring(idx
+ 1))));
+                setSecurityCredentialsProvider(new SecurityCredentialsBasicProvider(
+                    new SecurityCredentials(cred.substring(0, idx), cred.substring(idx +
1))));
             }
             else {
-                setSecurityCredentialsProvider(new GridSecurityCredentialsBasicProvider(
-                    new GridSecurityCredentials(null, null, cred)));
+                setSecurityCredentialsProvider(new SecurityCredentialsBasicProvider(
+                    new SecurityCredentials(null, null, cred)));
             }
         }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/219a2ee9/modules/core/src/main/java/org/apache/ignite/internal/client/impl/connection/GridClientConnectionManagerAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/client/impl/connection/GridClientConnectionManagerAdapter.java
b/modules/core/src/main/java/org/apache/ignite/internal/client/impl/connection/GridClientConnectionManagerAdapter.java
index 2a04ae8..166eed5 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/client/impl/connection/GridClientConnectionManagerAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/client/impl/connection/GridClientConnectionManagerAdapter.java
@@ -420,7 +420,7 @@ public abstract class GridClientConnectionManagerAdapter implements GridClientCo
                 }
             }
 
-            GridSecurityCredentials cred = null;
+            SecurityCredentials cred = null;
 
             try {
                 if (cfg.getSecurityCredentialsProvider() != null)

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/219a2ee9/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
b/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
index 775e5f8..adbfa76 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
@@ -331,7 +331,7 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi>
{
 
         if (ctx.security().enabled()) {
             spi.setAuthenticator(new DiscoverySpiNodeAuthenticator() {
-                @Override public SecurityContext authenticateNode(ClusterNode node, GridSecurityCredentials
cred) {
+                @Override public SecurityContext authenticateNode(ClusterNode node, SecurityCredentials
cred) {
                     try {
                         return ctx.security().authenticateNode(node, cred);
                     }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/219a2ee9/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java
index 89c34a3..ab5ef78 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java
@@ -464,21 +464,21 @@ public class GridRestProcessor extends GridProcessorAdapter {
         authCtx.subjectType(REMOTE_CLIENT);
         authCtx.subjectId(req.clientId());
 
-        GridSecurityCredentials cred;
+        SecurityCredentials cred;
 
-        if (req.credentials() instanceof GridSecurityCredentials)
-            cred = (GridSecurityCredentials)req.credentials();
+        if (req.credentials() instanceof SecurityCredentials)
+            cred = (SecurityCredentials)req.credentials();
         else if (req.credentials() instanceof String) {
             String credStr = (String)req.credentials();
 
             int idx = credStr.indexOf(':');
 
             cred = idx >= 0 && idx < credStr.length() ?
-                new GridSecurityCredentials(credStr.substring(0, idx), credStr.substring(idx
+ 1)) :
-                new GridSecurityCredentials(credStr, null);
+                new SecurityCredentials(credStr.substring(0, idx), credStr.substring(idx
+ 1)) :
+                new SecurityCredentials(credStr, null);
         }
         else {
-            cred = new GridSecurityCredentials();
+            cred = new SecurityCredentials();
 
             cred.setUserObject(req.credentials());
         }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/219a2ee9/modules/core/src/main/java/org/apache/ignite/internal/processors/security/GridSecurityProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/security/GridSecurityProcessor.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/security/GridSecurityProcessor.java
index 1ff16bb..bd36828 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/security/GridSecurityProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/security/GridSecurityProcessor.java
@@ -37,7 +37,7 @@ public interface GridSecurityProcessor extends GridProcessor {
      * @return {@code True} if succeeded, {@code false} otherwise.
      * @throws IgniteCheckedException If error occurred.
      */
-    public SecurityContext authenticateNode(ClusterNode node, GridSecurityCredentials cred)
throws IgniteCheckedException;
+    public SecurityContext authenticateNode(ClusterNode node, SecurityCredentials cred) throws
IgniteCheckedException;
 
     /**
      * Gets flag indicating whether all nodes or coordinator only should run the authentication
for joining node.

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/219a2ee9/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 3e4a937..783c981 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
@@ -39,7 +39,7 @@ public class GridOsSecurityProcessor extends GridProcessorAdapter implements
Gri
     }
 
     /** {@inheritDoc} */
-    @Override public SecurityContext authenticateNode(ClusterNode node, GridSecurityCredentials
cred)
+    @Override public SecurityContext authenticateNode(ClusterNode node, SecurityCredentials
cred)
         throws IgniteCheckedException {
         return null;
     }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/219a2ee9/modules/core/src/main/java/org/apache/ignite/plugin/security/AuthenticationContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/plugin/security/AuthenticationContext.java
b/modules/core/src/main/java/org/apache/ignite/plugin/security/AuthenticationContext.java
index 9239e9f..4885134 100644
--- a/modules/core/src/main/java/org/apache/ignite/plugin/security/AuthenticationContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/plugin/security/AuthenticationContext.java
@@ -31,7 +31,7 @@ public class AuthenticationContext {
     private UUID subjId;
 
     /** Credentials. */
-    private GridSecurityCredentials credentials;
+    private SecurityCredentials credentials;
 
     /** Subject address. */
     private InetSocketAddress addr;
@@ -77,7 +77,7 @@ public class AuthenticationContext {
      *
      * @return Security credentials.
      */
-    public GridSecurityCredentials credentials() {
+    public SecurityCredentials credentials() {
         return credentials;
     }
 
@@ -86,7 +86,7 @@ public class AuthenticationContext {
      *
      * @param credentials Security credentials.
      */
-    public void credentials(GridSecurityCredentials credentials) {
+    public void credentials(SecurityCredentials credentials) {
         this.credentials = credentials;
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/219a2ee9/modules/core/src/main/java/org/apache/ignite/plugin/security/GridSecurityCredentials.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/plugin/security/GridSecurityCredentials.java
b/modules/core/src/main/java/org/apache/ignite/plugin/security/GridSecurityCredentials.java
deleted file mode 100644
index b7fb045..0000000
--- a/modules/core/src/main/java/org/apache/ignite/plugin/security/GridSecurityCredentials.java
+++ /dev/null
@@ -1,184 +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.plugin.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.jetbrains.annotations.*;
-
-import java.io.*;
-
-/**
- * Security credentials used for client or node authentication. Security credentials
- * are provided by {@link GridSecurityCredentialsProvider} which is specified on
- * client or node startup in configuration.
- * <p>
- * Getting credentials through {@link GridSecurityCredentialsProvider} abstraction allows
- * users to provide custom implementations for storing user names and passwords in their
- * environment, possibly in encrypted format. Ignite comes with
- * {@link GridSecurityCredentialsBasicProvider} which simply provides
- * the passed in {@code login} and {@code password} when encryption or custom logic is not
required.
- * <p>
- * In addition to {@code login} and {@code password}, security credentials allow for
- * specifying {@link #setUserObject(Object) userObject} as well, which can be used
- * to pass in any additional information required for authentication.
- */
-public class GridSecurityCredentials implements Externalizable {
-    /** */
-    private static final long serialVersionUID = -2655741071578326256L;
-
-    /** Login. */
-    private Object login;
-
-    /** Password. */
-    @GridToStringExclude
-    private Object password;
-
-    /** Additional user object. */
-    @GridToStringExclude
-    private Object userObj;
-
-    /**
-     * Empty constructor required by {@link Externalizable}.
-     */
-    public GridSecurityCredentials() {
-        // No-op.
-    }
-
-    /**
-     * Constructs security credentials based on {@code login} and {@code password}.
-     *
-     * @param login Login.
-     * @param password Password.
-     */
-    public GridSecurityCredentials(String login, String password) {
-        this.login = login;
-        this.password = password;
-    }
-
-    /**
-     * Constructs security credentials based on {@code login}, {@code password},
-     * and custom user object.
-     *
-     * @param login Login.
-     * @param password Password.
-     * @param userObj User object.
-     */
-    public GridSecurityCredentials(String login, String password, @Nullable Object userObj)
{
-        this.login = login;
-        this.password = password;
-        this.userObj = userObj;
-    }
-
-    /**
-     * Gets login.
-     *
-     * @return Login.
-     */
-    public Object getLogin() {
-        return login;
-    }
-
-    /**
-     * Sets login.
-     *
-     * @param login Login.
-     */
-    public void setLogin(Object login) {
-        this.login = login;
-    }
-
-    /**
-     * Gets password.
-     *
-     * @return Password.
-     */
-    public Object getPassword() {
-        return password;
-    }
-
-    /**
-     * Sets password.
-     *
-     * @param password Password.
-     */
-    public void setPassword(Object password) {
-        this.password = password;
-    }
-
-    /**
-     * Gets user-specific object.
-     *
-     * @return User object.
-     */
-    @Nullable public Object getUserObject() {
-        return userObj;
-    }
-
-    /**
-     * Sets user-specific object.
-     *
-     * @param userObj User object.
-     */
-    public void setUserObject(@Nullable Object userObj) {
-        this.userObj = userObj;
-    }
-
-    /** {@inheritDoc} */
-    @Override public void writeExternal(ObjectOutput out) throws IOException {
-        out.writeObject(login);
-        out.writeObject(password);
-        out.writeObject(userObj);
-    }
-
-    /** {@inheritDoc} */
-    @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
{
-        login = in.readObject();
-        password = in.readObject();
-        userObj = in.readObject();
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean equals(Object o) {
-        if (this == o)
-            return true;
-
-        if (!(o instanceof GridSecurityCredentials))
-            return false;
-
-        GridSecurityCredentials that = (GridSecurityCredentials)o;
-
-        return F.eq(login, that.login) && F.eq(password, that.password) &&
F.eq(userObj, that.userObj);
-    }
-
-    /** {@inheritDoc} */
-    @Override public int hashCode() {
-        int res = login != null ? login.hashCode() : 0;
-
-        res = 31 * res + (password != null ? password.hashCode() : 0);
-        res = 31 * res + (userObj != null ? userObj.hashCode() : 0);
-
-        return res;
-    }
-
-    /** {@inheritDoc} */
-    @Override public String toString() {
-        return S.toString(GridSecurityCredentials.class, this);
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/219a2ee9/modules/core/src/main/java/org/apache/ignite/plugin/security/GridSecurityCredentialsBasicProvider.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/plugin/security/GridSecurityCredentialsBasicProvider.java
b/modules/core/src/main/java/org/apache/ignite/plugin/security/GridSecurityCredentialsBasicProvider.java
deleted file mode 100644
index a5f422b..0000000
--- a/modules/core/src/main/java/org/apache/ignite/plugin/security/GridSecurityCredentialsBasicProvider.java
+++ /dev/null
@@ -1,44 +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.plugin.security;
-
-import org.apache.ignite.*;
-
-/**
- * Basic implementation for {@link GridSecurityCredentialsProvider}. Use it
- * when custom logic for storing security credentials is not required and it
- * is OK to specify credentials directly in configuration.
- */
-public class GridSecurityCredentialsBasicProvider implements GridSecurityCredentialsProvider
{
-    /** */
-    private GridSecurityCredentials cred;
-
-    /**
-     * Constructs security credentials provider based on security credentials passed in.
-     *
-     * @param cred Security credentials.
-     */
-    public GridSecurityCredentialsBasicProvider(GridSecurityCredentials cred) {
-        this.cred = cred;
-    }
-
-    /** {@inheritDoc} */
-    @Override public GridSecurityCredentials credentials() throws IgniteCheckedException
{
-        return cred;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/219a2ee9/modules/core/src/main/java/org/apache/ignite/plugin/security/GridSecurityCredentialsProvider.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/plugin/security/GridSecurityCredentialsProvider.java
b/modules/core/src/main/java/org/apache/ignite/plugin/security/GridSecurityCredentialsProvider.java
index b83fe12..499fab6 100644
--- a/modules/core/src/main/java/org/apache/ignite/plugin/security/GridSecurityCredentialsProvider.java
+++ b/modules/core/src/main/java/org/apache/ignite/plugin/security/GridSecurityCredentialsProvider.java
@@ -26,11 +26,11 @@ import org.apache.ignite.*;
  * Getting credentials through {@link GridSecurityCredentialsProvider} abstraction allows
  * users to provide custom implementations for storing user names and passwords in their
  * environment, possibly in encrypted format. Ignite comes with
- * {@link GridSecurityCredentialsBasicProvider} which simply provides
+ * {@link SecurityCredentialsBasicProvider} which simply provides
  * the passed in {@code login} and {@code password} when encryption or custom logic is not
required.
  * <p>
  * In addition to {@code login} and {@code password}, security credentials allow for
- * specifying {@link GridSecurityCredentials#setUserObject(Object) userObject} as well, which
can be used
+ * specifying {@link SecurityCredentials#setUserObject(Object) userObject} as well, which
can be used
  * to pass in any additional information required for authentication.
  */
 public interface GridSecurityCredentialsProvider {
@@ -40,5 +40,5 @@ public interface GridSecurityCredentialsProvider {
      * @return Security credentials.
      * @throws IgniteCheckedException If failed.
      */
-    public GridSecurityCredentials credentials() throws IgniteCheckedException;
+    public SecurityCredentials credentials() throws IgniteCheckedException;
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/219a2ee9/modules/core/src/main/java/org/apache/ignite/plugin/security/SecurityCredentials.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/plugin/security/SecurityCredentials.java
b/modules/core/src/main/java/org/apache/ignite/plugin/security/SecurityCredentials.java
new file mode 100644
index 0000000..58a09ad
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/plugin/security/SecurityCredentials.java
@@ -0,0 +1,191 @@
+/*
+ * 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.plugin.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.jetbrains.annotations.*;
+
+import java.io.*;
+
+/**
+ * Security credentials used for node authentication. Security credentials
+ * are provided by {@link GridSecurityCredentialsProvider} which is specified on
+ * client or node startup in configuration.
+ * <p>
+ * Getting credentials through {@link GridSecurityCredentialsProvider} abstraction allows
+ * users to provide custom implementations for storing user names and passwords in their
+ * environment, possibly in encrypted format. Ignite comes with
+ * {@link SecurityCredentialsBasicProvider} which simply provides
+ * the passed in {@code login} and {@code password} when encryption or custom logic is not
required.
+ * <p>
+ * In addition to {@code login} and {@code password}, security credentials allow for
+ * specifying {@link #setUserObject(Object) userObject} as well, which can be used
+ * to pass in any additional information required for authentication.
+ */
+public class SecurityCredentials implements Externalizable {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /** Login. */
+    private Object login;
+
+    /** Password. */
+    @GridToStringExclude
+    private Object password;
+
+    /** Additional user object. */
+    @GridToStringExclude
+    private Object userObj;
+
+    /**
+     * Empty constructor required by {@link Externalizable}.
+     */
+    public SecurityCredentials() {
+        // No-op.
+    }
+
+    /**
+     * Constructs security credentials based on {@code login} and {@code password}.
+     *
+     * @param login Login.
+     * @param password Password.
+     */
+    public SecurityCredentials(
+        String login,
+        String password
+    ) {
+        this.login = login;
+        this.password = password;
+    }
+
+    /**
+     * Constructs security credentials based on {@code login}, {@code password},
+     * and custom user object.
+     *
+     * @param login Login.
+     * @param password Password.
+     * @param userObj User object.
+     */
+    public SecurityCredentials(
+        String login,
+        String password,
+        @Nullable Object userObj
+    ) {
+        this.login = login;
+        this.password = password;
+        this.userObj = userObj;
+    }
+
+    /**
+     * Gets login.
+     *
+     * @return Login.
+     */
+    public Object getLogin() {
+        return login;
+    }
+
+    /**
+     * Sets login.
+     *
+     * @param login Login.
+     */
+    public void setLogin(Object login) {
+        this.login = login;
+    }
+
+    /**
+     * Gets password.
+     *
+     * @return Password.
+     */
+    public Object getPassword() {
+        return password;
+    }
+
+    /**
+     * Sets password.
+     *
+     * @param password Password.
+     */
+    public void setPassword(Object password) {
+        this.password = password;
+    }
+
+    /**
+     * Gets user-specific object.
+     *
+     * @return User object.
+     */
+    @Nullable public Object getUserObject() {
+        return userObj;
+    }
+
+    /**
+     * Sets user-specific object.
+     *
+     * @param userObj User object.
+     */
+    public void setUserObject(@Nullable Object userObj) {
+        this.userObj = userObj;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void writeExternal(ObjectOutput out) throws IOException {
+        out.writeObject(login);
+        out.writeObject(password);
+        out.writeObject(userObj);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
{
+        login = in.readObject();
+        password = in.readObject();
+        userObj = in.readObject();
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean equals(Object o) {
+        if (this == o)
+            return true;
+
+        if (!(o instanceof SecurityCredentials))
+            return false;
+
+        SecurityCredentials that = (SecurityCredentials)o;
+
+        return F.eq(login, that.login) && F.eq(password, that.password) &&
F.eq(userObj, that.userObj);
+    }
+
+    /** {@inheritDoc} */
+    @Override public int hashCode() {
+        int res = login != null ? login.hashCode() : 0;
+
+        res = 31 * res + (password != null ? password.hashCode() : 0);
+        res = 31 * res + (userObj != null ? userObj.hashCode() : 0);
+
+        return res;
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(SecurityCredentials.class, this);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/219a2ee9/modules/core/src/main/java/org/apache/ignite/plugin/security/SecurityCredentialsBasicProvider.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/plugin/security/SecurityCredentialsBasicProvider.java
b/modules/core/src/main/java/org/apache/ignite/plugin/security/SecurityCredentialsBasicProvider.java
new file mode 100644
index 0000000..5491a5e
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/plugin/security/SecurityCredentialsBasicProvider.java
@@ -0,0 +1,44 @@
+/*
+ * 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.plugin.security;
+
+import org.apache.ignite.*;
+
+/**
+ * Basic implementation for {@link GridSecurityCredentialsProvider}. Use it
+ * when custom logic for storing security credentials is not required and it
+ * is OK to specify credentials directly in configuration.
+ */
+public class SecurityCredentialsBasicProvider implements GridSecurityCredentialsProvider
{
+    /** */
+    private SecurityCredentials cred;
+
+    /**
+     * Constructs security credentials provider based on security credentials passed in.
+     *
+     * @param cred Security credentials.
+     */
+    public SecurityCredentialsBasicProvider(SecurityCredentials cred) {
+        this.cred = cred;
+    }
+
+    /** {@inheritDoc} */
+    @Override public SecurityCredentials credentials() throws IgniteCheckedException {
+        return cred;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/219a2ee9/modules/core/src/main/java/org/apache/ignite/spi/discovery/DiscoverySpiNodeAuthenticator.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/DiscoverySpiNodeAuthenticator.java
b/modules/core/src/main/java/org/apache/ignite/spi/discovery/DiscoverySpiNodeAuthenticator.java
index 421307c..70dc572 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/DiscoverySpiNodeAuthenticator.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/DiscoverySpiNodeAuthenticator.java
@@ -35,7 +35,7 @@ public interface DiscoverySpiNodeAuthenticator {
      * @throws IgniteException If authentication process failed
      *      (invalid credentials should not lead to this exception).
      */
-    public SecurityContext authenticateNode(ClusterNode node, GridSecurityCredentials cred)
throws IgniteException;
+    public SecurityContext authenticateNode(ClusterNode node, SecurityCredentials cred) throws
IgniteException;
 
     /**
      * Gets global node authentication flag.

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/219a2ee9/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
index 1707666..9b38cad 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
@@ -1262,7 +1262,7 @@ public class TcpDiscoverySpi extends TcpDiscoverySpiAdapter implements
TcpDiscov
             spiState = CONNECTING;
         }
 
-        GridSecurityCredentials locCred = (GridSecurityCredentials)locNode.getAttributes()
+        SecurityCredentials locCred = (SecurityCredentials)locNode.getAttributes()
             .get(IgniteNodeAttributes.ATTR_SECURITY_CREDENTIALS);
 
         // Marshal credentials for backward compatibility and security.
@@ -1696,7 +1696,7 @@ public class TcpDiscoverySpi extends TcpDiscoverySpiAdapter implements
TcpDiscov
      * @return Security credentials.
      * @throws IgniteSpiException If unmarshal fails.
      */
-    private GridSecurityCredentials unmarshalCredentials(TcpDiscoveryNode node) throws IgniteSpiException
{
+    private SecurityCredentials unmarshalCredentials(TcpDiscoveryNode node) throws IgniteSpiException
{
         try {
             byte[] credBytes = (byte[])node.getAttributes().get(IgniteNodeAttributes.ATTR_SECURITY_CREDENTIALS);
 
@@ -3125,7 +3125,7 @@ public class TcpDiscoverySpi extends TcpDiscoverySpiAdapter implements
TcpDiscov
                 if (nodeAuth != null) {
                     // Authenticate node first.
                     try {
-                        GridSecurityCredentials cred = unmarshalCredentials(node);
+                        SecurityCredentials cred = unmarshalCredentials(node);
 
                         SecurityContext subj = nodeAuth.authenticateNode(node, cred);
 
@@ -3472,7 +3472,7 @@ public class TcpDiscoverySpi extends TcpDiscoverySpiAdapter implements
TcpDiscov
                     boolean authFailed = true;
 
                     try {
-                        GridSecurityCredentials cred = unmarshalCredentials(node);
+                        SecurityCredentials cred = unmarshalCredentials(node);
 
                         if (cred == null) {
                             if (log.isDebugEnabled())

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/219a2ee9/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java
----------------------------------------------------------------------
diff --git a/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java
b/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java
index 579cf35..9c60c61 100644
--- a/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java
+++ b/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java
@@ -453,7 +453,7 @@ public class GridJettyRestHandler extends AbstractHandler {
         restReq.command(cmd);
 
         if (params.containsKey("ignite.login") || params.containsKey("ignite.password"))
{
-            GridSecurityCredentials cred = new GridSecurityCredentials(
+            SecurityCredentials cred = new SecurityCredentials(
                 (String)params.get("ignite.login"), (String)params.get("ignite.password"));
 
             restReq.credentials(cred);


Mime
View raw message