private AuthenticationDescriptor getAuthenticationModel(String login, char[] password) {
        String hash = login + ":" + new String(password);
        
        if (modelCache.containsKey(hash)) {
            AuthenticationDescriptor cachedModel = modelCache.get(hash);
            if (cachedModel != null) {
                return cachedModel;
            }
        }
        
        Client client = ClientBuilder.newClient();
        WebTarget target = client.target(serviceURI);
        try {

            AuthenticationDescriptor model = target
                    .request()
                    .header("Authorization", "Basic " + DatatypeConverter.printBase64Binary(hash.getBytes(this.getProperty(PARAM_CHARSET))))
                    .get(AuthenticationDescriptor.class);
            
            synchronized (this) {
                modelCache.put(hash, model);
            }
            
            setGroupNames(model.getName(), model.getGroups());
            
            return model;
        } catch (Exception ex) {
            _logger.log(Level.SEVERE, "restrealm.invaliduser", login);
            if (_logger.isLoggable(Level.FINE)) {
                _logger.log(Level.FINE, "Cannot validate user", ex);
            }
        } finally {
            client.close();
        }
        return null;
    }