private ILogger getLogger() { return clientEngine.getLogger(getClass()); }
public ClientEndpointImpl(ClientEngineImpl clientEngine, NodeEngineImpl nodeEngine, Connection connection) { this.clientEngine = clientEngine; this.logger = clientEngine.getLogger(getClass()); this.nodeEngine = nodeEngine; this.connection = connection; if (connection instanceof TcpIpConnection) { TcpIpConnection tcpIpConnection = (TcpIpConnection) connection; socketAddress = tcpIpConnection.getRemoteSocketAddress(); } else { socketAddress = null; } this.clientVersion = BuildInfo.UNKNOWN_HAZELCAST_VERSION; this.clientVersionString = "Unknown"; this.creationTime = System.currentTimeMillis(); }
private void setConnectionType() { String type = getClientType(); if (ClientTypes.JAVA.equals(type)) { connection.setType(ConnectionType.JAVA_CLIENT); } else if (ClientTypes.CSHARP.equals(type)) { connection.setType(ConnectionType.CSHARP_CLIENT); } else if (ClientTypes.CPP.equals(type)) { connection.setType(ConnectionType.CPP_CLIENT); } else if (ClientTypes.PYTHON.equals(type)) { connection.setType(ConnectionType.PYTHON_CLIENT); } else if (ClientTypes.RUBY.equals(type)) { connection.setType(ConnectionType.RUBY_CLIENT); } else if (ClientTypes.NODEJS.equals(type)) { connection.setType(ConnectionType.NODEJS_CLIENT); } else if (ClientTypes.GO.equals(type)) { connection.setType(ConnectionType.GO_CLIENT); } else { clientEngine.getLogger(getClass()).info("Unknown client type: " + type); connection.setType(ConnectionType.BINARY_CLIENT); } }
private ClientMessage prepareUnauthenticatedClientMessage() { Connection connection = endpoint.getConnection(); ILogger logger = clientEngine.getLogger(getClass()); logger.warning("Received auth from " + connection + " with principal " + principal + ", authentication failed"); byte status = AuthenticationStatus.CREDENTIALS_FAILED.getId(); return encodeAuth(status, null, null, null, serializationService.getVersion(), null); }
private AuthenticationStatus authenticate() { ILogger logger = clientEngine.getLogger(getClass()); AuthenticationStatus status; if (credentials == null) { status = AuthenticationStatus.CREDENTIALS_FAILED; logger.severe("Could not retrieve Credentials object!"); } else if (clientEngine.getSecurityContext() != null) { status = authenticate(clientEngine.getSecurityContext()); } else if (credentials instanceof UsernamePasswordCredentials) { UsernamePasswordCredentials usernamePasswordCredentials = (UsernamePasswordCredentials) credentials; status = authenticate(usernamePasswordCredentials); } else { status = AuthenticationStatus.CREDENTIALS_FAILED; logger.severe("Hazelcast security is disabled.\nUsernamePasswordCredentials or cluster " + "group-name and group-password should be used for authentication!\n" + "Current credentials type is: " + credentials.getClass().getName()); } return status; }
@Override public void init(NodeEngine nodeEngine, Properties properties) { node.getConnectionManager().addConnectionListener(connectionListener); ClientHeartbeatMonitor heartbeatMonitor = new ClientHeartbeatMonitor( endpointManager, getLogger(ClientHeartbeatMonitor.class), nodeEngine.getExecutionService(), node.getProperties()); heartbeatMonitor.start(); }
@Override public void init(NodeEngine nodeEngine, Properties properties) { node.getConnectionManager().addConnectionListener(connectionListener); ClientHeartbeatMonitor heartbeatMonitor = new ClientHeartbeatMonitor( endpointManager, getLogger(ClientHeartbeatMonitor.class), nodeEngine.getExecutionService(), node.getProperties()); heartbeatMonitor.start(); }
private ClientMessage prepareAuthenticatedClientMessage() { Connection connection = endpoint.getConnection(); ILogger logger = clientEngine.getLogger(getClass()); endpoint.authenticated(principal, credentials, isOwnerConnection(), clientVersion, clientMessage.getCorrelationId()); setConnectionType(); logger.info("Received auth from " + connection + ", successfully authenticated" + ", principal: " + principal + ", owner connection: " + isOwnerConnection() + ", client version: " + clientVersion); if (endpointManager.registerEndpoint(endpoint)) { clientEngine.bind(endpoint); } final Address thisAddress = clientEngine.getThisAddress(); byte status = AuthenticationStatus.AUTHENTICATED.getId(); return encodeAuth(status, thisAddress, principal.getUuid(), principal.getOwnerUuid(), serializationService.getVersion(), Collections.<Member>emptyList()); }