[ 
https://issues.apache.org/jira/browse/GEODE-2573?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Andrei Biketov updated GEODE-2573:
----------------------------------

Hi Nilkanth,

Is this code correct, that is where it is failing, Why do you
getCredentials only  if(communicationMode == Acceptor.GATEWAY_TO_GATEWAY)
I put a breakpoint here and in my case null is passed for credentials. In
my case communicationMode is CLIENT_TO_SERVER = (byte)100;

 public ServerQueueStatus greet(Connection conn, ServerLocation location,
byte communicationMode) throws IOException,
      AuthenticationRequiredException, AuthenticationFailedException,
      ServerRefusedConnectionException {
    try {
      ServerQueueStatus serverQStatus = null;
      Socket sock = conn.getSocket();
      DataOutputStream dos = new DataOutputStream(sock.getOutputStream());
      final InputStream in = sock.getInputStream();
      DataInputStream dis = new DataInputStream(in);
      DistributedMember member = getDistributedMember(sock);
      // if running in a loner system, use the new port number in the ID to
      // help differentiate from other clients
      DM dm =
((InternalDistributedSystem)this.system).getDistributionManager();
      InternalDistributedMember idm = dm.getDistributionManagerId();
      synchronized(idm) {
        if (idm.getPort() == 0 && dm instanceof LonerDistributionManager) {
          int port = sock.getLocalPort();
          ((LonerDistributionManager)dm).updateLonerPort(port);
          updateProxyID(dm.getDistributionManagerId());
        }
      }
    *  if(communicationMode == Acceptor.GATEWAY_TO_GATEWAY) {*
*        this.credentials = getCredentials(member);*
*      }*
      byte intermediateAcceptanceCode = write(dos, dis, communicationMode,
          REPLY_OK, this.clientReadTimeout, null,* this.credentials*,
member,
          false);

Andrei





> Client authentication to secured geode cluster fails
> ----------------------------------------------------
>
>                 Key: GEODE-2573
>                 URL: https://issues.apache.org/jira/browse/GEODE-2573
>             Project: Geode
>          Issue Type: Bug
>          Components: client/server
>    Affects Versions: 1.1.0
>            Reporter: Andrei Biketov
>
> I have simple setup: one locator and one server, both secured. Now I'm trying 
> to connect to the cluster from the client. I'm passing credentials as 
> security-username/security-password from the client but I'm getting exception:
> [info 2017/03/01 22:45:40.220 EST <poolTimer-DEFAULT-3> tid=0x1b] Error 
> prefilling connections : 
> org.apache.geode.security.AuthenticationRequiredException: No security 
> credentials are provided
> org.apache.geode.security.AuthenticationRequiredException: No security 
> credentials are provided
>       at 
> org.apache.geode.internal.cache.tier.sockets.HandShake.readMessage(HandShake.java:1473)
>       at 
> org.apache.geode.internal.cache.tier.sockets.HandShake.greet(HandShake.java:1327)
>       at 
> org.apache.geode.cache.client.internal.ConnectionImpl.connect(ConnectionImpl.java:108)
>       at 
> org.apache.geode.cache.client.internal.ConnectionFactoryImpl.createClientToServerConnection(ConnectionFactoryImpl.java:135)
>       at 
> org.apache.geode.cache.client.internal.ConnectionFactoryImpl.createClientToServerConnection(ConnectionFactoryImpl.java:252)
>       at 
> org.apache.geode.cache.client.internal.pooling.ConnectionManagerImpl.prefillConnection(ConnectionManagerImpl.java:758)
>       at 
> org.apache.geode.cache.client.internal.pooling.ConnectionManagerImpl.prefill(ConnectionManagerImpl.java:701)
>       at 
> org.apache.geode.cache.client.internal.pooling.ConnectionManagerImpl$PrefillConnectionsTask.run2(ConnectionManagerImpl.java:852)
>       at 
> org.apache.geode.cache.client.internal.PoolImpl$PoolTask.run(PoolImpl.java:1235)
>       at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
>       at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
>       at java.lang.Thread.run(Thread.java:745)
> Code:
> ClientCache cache = null;
>               Properties props = new Properties();
>               props.setProperty("security-username", "admin");
>               props.setProperty("security-password", "secret");
>               try {
>                       System.out.println("Client app connecting to Geode 
> cluster");
>                       cache = new 
> ClientCacheFactory(props).addPoolLocator("localhost", 10334).create();
>                       
>                       Region<String, String> customer = 
> cache.getRegion("customer");
>                       String value = customer.get("1");
>                        System.out.println("Value from the region:" + value);
>               } catch (Exception e) {
>                       System.out.println("Error creating the Client Cache'");
>                       System.out.println(e.getCause());
>                       throw e;
>               }



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to